Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BroadcastMessage ¶
func BroadcastMessage(msg string)
BroadcastMessage send broadcast message to channel and record stats
func HandleWebSocketCommand ¶
func HandleWebSocketCommand(cmd, usage string, handler func(c *WebsocketConnection, array []string))
HandleWebSocketCommand used to register command and handler
Types ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub maintains the set of active connections and broadcasts messages to the connections.
type WebsocketConnection ¶
type WebsocketConnection struct {
// contains filtered or unexported fields
}
WebsocketConnection is an middleman between the websocket connection and the hub.
func (*WebsocketConnection) Broadcast ¶
func (c *WebsocketConnection) Broadcast(msg string)
Broadcast public message to all channels
func (*WebsocketConnection) WriteMessage ¶
func (c *WebsocketConnection) WriteMessage(t MsgType, msg string) error
WriteMessage will use the right way to write message, don't call c.write directly
func (*WebsocketConnection) WritePrivateMessage ¶
func (c *WebsocketConnection) WritePrivateMessage(msg string) error
WritePrivateMessage will send msg to channel
type WebsocketHandlerFunc ¶
type WebsocketHandlerFunc func(c *WebsocketConnection, array []string)
WebsocketHandlerFunc define the func to handle websocket
Click to show internal directories.
Click to hide internal directories.