ws

package
v0.0.0-...-df158c1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	GetID() int32
	GetRemoteAddr() net.Addr

	Send(msg *messages.Message)
	Close()

	ReadPump()
	SendPump()
}

Client contains all the methods we need for recognising and working with the Client

func NewClient

func NewClient(conn *websocket.Conn, serv Server, logger *zap.Logger) Client

NewClient creates new instance of client with randomly generated id and remote adres, it also connects him to server with websocket and allows server to comunicate with him

type Server

type Server interface {
	Run()

	Connect(w http.ResponseWriter, r *http.Request) Client
	Disconnect(client Client)
	Broadcast(excludeClient int32, msg *messages.Message)
}

Server starts the Run connect and disconnect methods

func NewServer

func NewServer(logger *zap.Logger) Server

NewServer return all the data for the server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL