Back to godoc.org

Package broadcast

v0.0.0-...-689a9a2
Latest Go to latest

The highest tagged major version is .

Published: Jan 15, 2020 | License: Apache-2.0 | Module: bitbucket.org/intevation/kugelblitz

Index

type AlarmStreamBroker

type AlarmStreamBroker struct {
	// contains filtered or unexported fields
}

AlarmStreamBroker registers to a Receiver and broadcasts the transcripted alarm messages to the SSE clients.

func NewAlarmStreamBroker

func NewAlarmStreamBroker() *AlarmStreamBroker

NewAlarmStreamBroker creates a new AlarmStreamBroker.

func (*AlarmStreamBroker) HandleAlarm

func (asb *AlarmStreamBroker) HandleAlarm(msg json.RawMessage) error

HandleAlarm is the entry point for "Alarm" events.

func (*AlarmStreamBroker) HandleAllClear

func (asb *AlarmStreamBroker) HandleAllClear(msg json.RawMessage) error

HandleAllClear is the entry point for "Entwarnung" events.

func (*AlarmStreamBroker) HandleHeartbeat

func (asb *AlarmStreamBroker) HandleHeartbeat(json.RawMessage) error

HandleHeartbeat handles the hearbeat in the alarmstream

func (*AlarmStreamBroker) HandleTestAlarm

func (asb *AlarmStreamBroker) HandleTestAlarm(msg json.RawMessage) error

HandleTestAlarm is the entry point for "Testalarm" events.

func (*AlarmStreamBroker) HandleTestAllClear

func (asb *AlarmStreamBroker) HandleTestAllClear(msg json.RawMessage) error

HandleTestAllClear is the entry point for "Testentwarnung" events.

func (*AlarmStreamBroker) RegisterClient

func (asb *AlarmStreamBroker) RegisterClient(key string, id int64, queue *Queue)

RegisterClient is called to register a SSE client.

func (*AlarmStreamBroker) Run

func (asb *AlarmStreamBroker) Run()

Run starts the dispatching and does not return.

func (*AlarmStreamBroker) SessionDied

func (asb *AlarmStreamBroker) SessionDied(key string)

SessionDied is a called when a session died.

func (*AlarmStreamBroker) UnregisterClient

func (asb *AlarmStreamBroker) UnregisterClient(key string, queue *Queue)

UnregisterClient is called to remove a SSE client previously registered.

type MessageHandler

type MessageHandler func(json.RawMessage) error

MessageHandler is the function type to receive the dispatched raw message.

type PointstreamBroker

type PointstreamBroker struct {
	// contains filtered or unexported fields
}

PointstreamBroker registers to a Receiver and broadcasts the transcripted lighting messages to the SSE clients.

func NewPointStreamBroker

func NewPointStreamBroker() *PointstreamBroker

NewPointStreamBroker creates a new PointstreamBroker.

func (*PointstreamBroker) Handle

func (psb *PointstreamBroker) Handle(msg json.RawMessage) error

Handle is the message entry point from the Listen/Notify receiver.

func (*PointstreamBroker) HandleHeartbeat

func (psb *PointstreamBroker) HandleHeartbeat(json.RawMessage) error

HandleHeartbeat handle the heartbeat from the Listen/Notify receiver.

func (*PointstreamBroker) RegisterClient

func (psb *PointstreamBroker) RegisterClient(
	key string,
	geom wkt.Geom,
	out *Queue)

RegisterClient is to be called to register new SSE clients.

func (*PointstreamBroker) Run

func (psb *PointstreamBroker) Run()

Run starts the dispatching and does not return.

func (*PointstreamBroker) SessionDied

func (psb *PointstreamBroker) SessionDied(key string)

SessionDied is called if a session dies to disconnect the respective clients.

func (*PointstreamBroker) UnregisterClient

func (psb *PointstreamBroker) UnregisterClient(key string, out *Queue)

UnregisterClient is called to remove a SSE client from the broker.

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

Queue is a queue to exchange byte slices between go routines without limited size of channels.

func NewQueue

func NewQueue() *Queue

NewQueue creates a new queue.

func (*Queue) Append

func (q *Queue) Append(v []byte)

Append inserts a new value v at the back of queue q.

func (*Queue) Close

func (q *Queue) Close()

Close closes the queue.

func (*Queue) Remove

func (q *Queue) Remove() ([]byte, bool)

Remove removes and returns the first element of queue q or nil.

type Receiver

type Receiver struct {
	// contains filtered or unexported fields
}

Receiver encapsulates the de-multiplexing of messages from a PostgreSQL Listen/Notify to a number of registered handlers.

func NewReceiver

func NewReceiver(dsn string) *Receiver

NewReceiver creates a new reciever with a given domain source name.

func (*Receiver) AddHandler

func (rcv *Receiver) AddHandler(msgType string, handler MessageHandler)

AddHandler registers a handler for a message type.

func (*Receiver) Run

func (rcv *Receiver) Run()

Run starts the receiving in a loop and does not return.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier