Documentation ¶
Index ¶
- type Event
- type Hub
- func (hub *Hub) AddRotator(r rotator.Rotator) error
- func (hub *Hub) Broadcast(ev Event)
- func (hub *Hub) ListenHTTP(host string, port int, errorCh chan<- struct{})
- func (hub *Hub) ListenTCP(host string, port int, tcpError chan<- bool)
- func (hub *Hub) RemoveRotator(r rotator.Rotator)
- func (hub *Hub) Rotator(name string) (rotator.Rotator, bool)
- func (hub *Hub) Rotators() []rotator.Rotator
- type RotatorEvent
- type TCPClient
- type WsClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { Name RotatorEvent `json:"name,omitempty"` RotatorName string `json:"rotator_name,omitempty"` Heading rotator.Heading `json:"heading,omitempty"` }
type Hub ¶
Hub is a struct which makes a rotator available through network interfaces, supporting several protocols.
func (*Hub) AddRotator ¶
AddRotator adds / registers a rotator. The rotator's name must be unique.
func (*Hub) ListenHTTP ¶
ListenHTTP starts a HTTP Server on a given network adapter / port and sets a HTTP and Websocket handler. Since this function contains an endless loop, it should be executed in a go routine. If the listener can not be initialized, it will close the errorCh channel.
func (*Hub) ListenTCP ¶
ListenTCP starts a TCP listener on a given network adapter / port. Since this function contains an endless loop, it should be executed in a go routine. If the listener can not be initialized, it will close the tcpError channel.
func (*Hub) RemoveRotator ¶
RemoveRotator deletes / de-registers a rotator.
type RotatorEvent ¶
type RotatorEvent string
const ( AddRotator RotatorEvent = "add" RemoveRotator RotatorEvent = "remove" UpdateHeading RotatorEvent = "heading" )