Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Upgrader = websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferSize: 1024,
}
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { // The websocket connection id. ID string // The websocket connection. Ws *websocket.Conn // The websocket filter. Filter *model.Filter // Buffered channel of outbound messages. Send chan *model.Log }
connection is an middleman between the websocket connection and the hub.
func (*Connection) Write ¶
func (c *Connection) Write(mt int, payload []byte) error
write writes a message with the given message type and payload.
func (*Connection) WritePump ¶
func (c *Connection) WritePump()
writePump pumps messages from the hub to the websocket connection.
type Hub ¶
type Hub struct { // Registered connections. Connections map[*Connection]bool // Inbound messages from the connections. Broadcast chan *model.Log // Register requests from the connections. Register chan *Connection // Unregister requests from connections. Unregister chan *Connection // RegisterFilter registers filter for specified connection. RegisterFilter chan *model.Filter // UnregisterFilter unregisters filter for specified connection. UnregisterFilter chan string }
hub maintains the set of active connections and broadcasts messages to the connections.
Click to show internal directories.
Click to hide internal directories.