Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChannelStats ¶
type Client ¶
type Client struct { Hub *Hub Name string //for filtering who to send messages to Send chan Message // for outbound messages to client Stats *ClientStats Topic string // message broadcast scope is restricted to a single topic Done chan struct{} }
Client is a middleperson between the hub and whatever is sending/receiving messages on it
type ClientReport ¶
type ClientReport struct { Topic string `json:"topic"` Connected string `json:"connected"` Stats ClientRxTx `json:"stats"` }
Stats that we report externally
type ClientRxTx ¶
type ClientRxTx struct { Tx ChannelStats `json:"tx"` Rx ChannelStats `json:"rx"` }
type ClientStats ¶
Stats that we keep internally
func NewClientStats ¶
func NewClientStats() *ClientStats
type Hub ¶
type Hub struct { // Registered clients. Clients map[string]map[*Client]bool // Inbound messages from the clients. Broadcast chan Message // Register requests from the clients. Register chan *Client // Unregister requests from clients. Unregister chan *Client Stats HubStats }
Hub maintains the set of active clients and broadcasts messages to the clients. From gorilla/websocket chat
func (*Hub) RunWithStats ¶
func (h *Hub) RunWithStats(closed chan struct{})
type HubReport ¶
type HubReport struct { Started string `json:"started"` Last string `json:"last"` Audience WelfordStats `json:"audience"` Bytes WelfordStats `json:"bytes"` Latency WelfordStats `json:"latency"` Dt WelfordStats `json:"dt"` }
Stats that we report externally
Click to show internal directories.
Click to hide internal directories.