WebSocket hub
A WebSocket hub is a central component that manages active client connections and distributes messages to them. In this course, it maintains a subscribers map and gives each connected client an independent buffered send channel, allowing order-tracking updates to be distributed without performing network writes inside the hub.
Minimal example
type Hub struct {
mu sync.Mutex
subscribers map[*Client]bool
}
type Client struct {
conn *websocket.Conn
send chan []byte
}