Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Reader ¶
func Reader(body io.ReadCloser, ch MessageChan) error
Reader returns a channel that contains parsed SSE messages.
func WriteMessages ¶
func WriteMessages(w http.ResponseWriter, messageChan chan Message) error
WriteMessages writes SSE formatted messages to the writer
Types ¶
type Broker ¶
type Broker struct { // Events are pushed to this channel by the main UDP daemon Notifier chan Message // contains filtered or unexported fields }
Broker holds open client connections, listens for incoming events on its Notifier channel and broadcast event data to all registered connections
func (*Broker) CloseClient ¶
func (broker *Broker) CloseClient(ch MessageChan)
CloseClient closes the client channel
type Message ¶
Message is a message.
type MessageChan ¶
type MessageChan chan Message
A MessageChan is a channel of channels Each connection sends a channel of bytes to a global MessageChan The main broker listen() loop listens on new connections on MessageChan New event messages are broadcast to all registered connection channels
func StartConnection ¶
func StartConnection(broker *Broker) (MessageChan, error)
StartConnection starts a SSE connection, based on an existing HTTP connection.
Click to show internal directories.
Click to hide internal directories.