Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client manages a specific websocket connection to a client
type EventHandler ¶
type EventHandler interface { // OnClientConnect is called once each time a new client connects to the manager. OnClientConnect(sendToClient chan interface{}) // OnEventReceived will be called each time any client sends an event. OnEventReceived(event interface{}, sendToAll chan interface{}) }
EventHandler is an interface for handling websocket events
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
A Manager maintains and manages the list of websocket connections
func GetManager ¶
func GetManager() *Manager
GetManager returns the manager, and creates a new one if it has not made one before
func (*Manager) SetEventHandler ¶
func (m *Manager) SetEventHandler(handler EventHandler)
SetEventHandler sets the eventHandler for the websocket manager
func (*Manager) SetMessenger ¶
SetMessenger sets the event Messenger for the websocket manager
func (*Manager) WriteToSockets ¶
func (m *Manager) WriteToSockets(e interface{})
WriteToSockets writes events out to the clients on the socket connections
Click to show internal directories.
Click to hide internal directories.