Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
Hub *Hub
Name string //for filtering who to send messages to
Send chan Message // for outbound messages to client
Topic string // message broadcast scope is restricted to a single topic
Done chan struct{}
ConnectedAt time.Time
}
Client is a middleperson between the hub and whatever is sending/receiving messages on it
type ClientReport ¶
ClientReport represents statistics that we report externally
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
}
Hub maintains the set of active clients and broadcasts messages to the clients. From gorilla/websocket chat
Click to show internal directories.
Click to hide internal directories.