Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub relays messages on to its listeners
func New ¶
New constructs a new Hub which will cache historyLen messages in memory for playback to future listeners. A goroutine is created to handle incoming messages; it will run until the provided context is canceled.
func (*Hub) AddListener ¶
AddListener registers a listener to receive broadcasted messages.
func (*Hub) Dispatch ¶
Dispatch queues a message for broadcast by the hub. The message will be placed into the history buffer and then relayed to all registered listeners.
func (*Hub) RemoveListener ¶
RemoveListener deletes a listener registration, it will cease to receive messages.
Click to show internal directories.
Click to hide internal directories.