Documentation ¶
Index ¶
- func BroadcastMessage(msg string)
- func HandleWebSocketCommand(cmd string, handler func(c *WebsocketConnection, array []string))
- func InitWebSocket(env *env.Env)
- func ServeWs(w http.ResponseWriter, r *http.Request)
- type Command
- func (this Command) AddSeed(c *WebsocketConnection, a []string)
- func (this Command) Dispatch(c *WebsocketConnection, a []string)
- func (this Command) GetTask(c *WebsocketConnection, a []string)
- func (this Command) Help(c *WebsocketConnection, a []string)
- func (this Command) UpdateLogLevel(c *WebsocketConnection, a []string)
- type Hub
- type MsgType
- type WebsocketConnection
- type WebsocketHandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BroadcastMessage ¶
func BroadcastMessage(msg string)
func HandleWebSocketCommand ¶
func HandleWebSocketCommand(cmd string, handler func(c *WebsocketConnection, array []string))
func InitWebSocket ¶
Types ¶
type Command ¶
type Command struct { }
func (Command) AddSeed ¶
func (this Command) AddSeed(c *WebsocketConnection, a []string)
func (Command) Dispatch ¶
func (this Command) Dispatch(c *WebsocketConnection, a []string)
func (Command) GetTask ¶
func (this Command) GetTask(c *WebsocketConnection, a []string)
func (Command) Help ¶
func (this Command) Help(c *WebsocketConnection, a []string)
func (Command) UpdateLogLevel ¶
func (this Command) UpdateLogLevel(c *WebsocketConnection, a []string)
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
}
connection is an middleman between the websocket connection and the hub.
func (*WebsocketConnection) Broadcast ¶
func (c *WebsocketConnection) Broadcast(msg string)
func (*WebsocketConnection) WriteMessage ¶
func (c *WebsocketConnection) WriteMessage(t MsgType, msg string) error
the right way to write message, don't call c.write directly
func (*WebsocketConnection) WritePrivateMessage ¶
func (c *WebsocketConnection) WritePrivateMessage(msg string) error
type WebsocketHandlerFunc ¶
type WebsocketHandlerFunc func(c *WebsocketConnection, array []string)
Click to show internal directories.
Click to hide internal directories.