Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BroadcastMessage ¶
type ClientErrorMessage ¶
type ClientWelcomeMessage ¶
type HttpServer ¶
func NewHttpServer ¶
func NewHttpServer(httpServerAddr string, wsCommandFnRegistry map[string]WsCommandFn) (*HttpServer, error)
func (*HttpServer) Run ¶
func (s *HttpServer) Run(waitGroup *sync.WaitGroup)
type ReceivedMessage ¶
type WsClient ¶
type WsClient struct { SendMessage chan WsMessageContainer // contains filtered or unexported fields }
Client is a middleman between the websocket connection and the hub.
func (*WsClient) RemoteAddrStr ¶
type WsCommand ¶
type WsCommand struct { MessageData map[string]interface{} WsClient *WsClient Fn WsCommandFn }
func NewWsCommand ¶
func NewWsCommand(messageData map[string]interface{}, wsClient *WsClient, fn WsCommandFn) *WsCommand
type WsCommandFn ¶
type WsHub ¶
type WsHub struct { sync.Mutex WsCommandFnRegistry map[string]WsCommandFn Broadcast chan BroadcastMessage // contains filtered or unexported fields }
Hub maintains the set of active clients and broadcasts messages to the clients.
type WsMessageContainer ¶
type WsMessageContainer struct { Type string `json:"type"` Data interface{} `json:"data"` }
func NewWsMessageContainer ¶
func NewWsMessageContainer(type_ string, data interface{}) WsMessageContainer
Click to show internal directories.
Click to hide internal directories.