Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var HManager = HubManager{ Hubs: make(map[string]*Hub), // contains filtered or unexported fields }
View Source
var Manager = EchoClientManager{ Broadcast: make(chan []byte), Register: make(chan *EchoClient), Unregister: make(chan *EchoClient), EchoClients: make(map[*EchoClient]bool), }
Manager define a echo server manager
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a middleman between the websocket connection and the hub.
type EchoClient ¶
EchoClient is a websocket client
func (*EchoClient) Read ¶
func (c *EchoClient) Read()
func (*EchoClient) Write ¶
func (c *EchoClient) Write()
type EchoClientManager ¶
type EchoClientManager struct { EchoClients map[*EchoClient]bool Broadcast chan []byte Register chan *EchoClient Unregister chan *EchoClient }
EchoClientManager is a websocket manager
func (*EchoClientManager) Send ¶
func (manager *EchoClientManager) Send(message []byte, ignore *EchoClient)
Send is to send ws message to ws client
func (*EchoClientManager) Start ¶
func (manager *EchoClientManager) Start()
Start is to start a ws server
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub maintains the set of active clients and broadcasts messages to the clients.
type HubManager ¶
Click to show internal directories.
Click to hide internal directories.