Documentation ¶
Overview ¶
Package broadcast implements multi-listener broadcast channels. See https://github.com/dustin/go-broadcast for original implementation and example.
Package broadcast provides pubsub of messages over channels. A provider has a Broadcaster into which it Submits messages and into which subscribers Register to pick up those messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BroadcastMessage ¶
type BroadcastMessage struct { Type BroadcastType Message interface{} }
type BroadcastType ¶
type BroadcastType string
const ( // OperatorSyncChannel is a broadcast channel type for operator status messages. OperatorSyncChannel BroadcastType = "operator-sync" )
type Broadcaster ¶
type Broadcaster interface { // Register a new channel to receive broadcasts Register(chan<- BroadcastMessage) // Unregister a channel so that it no longer receives broadcasts. Unregister(chan<- BroadcastMessage) // Shut this broadcaster down. Close() error // Submit a new object to all subscribers Submit(BroadcastMessage) }
The Broadcaster interface describes the main entry points to broadcasters.
func NewBroadcaster ¶
func NewBroadcaster(buflen int) Broadcaster
NewBroadcaster creates a new broadcaster with the given input channel buffer length.
Click to show internal directories.
Click to hide internal directories.