Documentation ¶
Index ¶
- type BroadcastExcept
- type Connection
- type Event
- type OnMessageReceivedFunc
- type Overlay
- func (o *Overlay) AssignOnMessageReceived(onMessageReceived OnMessageReceivedFunc)
- func (o *Overlay) ConnectionClose(connection *Connection)
- func (o *Overlay) Init()
- func (o *Overlay) RegisterConnection(connection *Connection)
- func (o *Overlay) SendConnections(message []byte)
- func (o *Overlay) SendConnectionsExcept(except *Connection, message []byte)
- func (o *Overlay) UnregisterConnection(connection *Connection)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BroadcastExcept ¶
type BroadcastExcept struct { Connection *Connection Message []byte }
type Connection ¶
type Connection struct { Send chan []byte // contains filtered or unexported fields }
Connection is a websocket connection for the OBS Overlay.
func NewOverlayConnection ¶
func NewOverlayConnection(overlay *Overlay, conn *websocket.Conn) *Connection
NewOverlayConnection returns a new overlay connection.
func (*Connection) ReadPump ¶
func (o *Connection) ReadPump()
ReadPump reads incoming socket data on the overlay connection.
func (*Connection) WritePump ¶
func (o *Connection) WritePump()
WritePump writes outgoing socket data on the overlay connection.
type Event ¶
type Event struct { Type string `json:"type"` Payload interface{} `json:"payload"` }
Event is a json encoded message that gets sent to the frontend.
type OnMessageReceivedFunc ¶
type OnMessageReceivedFunc func(*Overlay, *Connection, []byte)
type Overlay ¶
type Overlay struct { Connections map[*Connection]struct{} Broadcast chan []byte BroadcastExcept chan BroadcastExcept Register chan *Connection Unregister chan *Connection OnMessageReceived func(*Overlay, *Connection, []byte) // contains filtered or unexported fields }
Overlay managed multiple websocket connections to the overlay.
func (*Overlay) AssignOnMessageReceived ¶
func (o *Overlay) AssignOnMessageReceived(onMessageReceived OnMessageReceivedFunc)
func (*Overlay) ConnectionClose ¶
func (o *Overlay) ConnectionClose(connection *Connection)
ConnectionClose closes a connection with the overlay.
func (*Overlay) Init ¶
func (o *Overlay) Init()
Init starts an Overlay. Should be run in a separate go routine.
func (*Overlay) RegisterConnection ¶
func (o *Overlay) RegisterConnection(connection *Connection)
RegisterConnection registers a connection with the overlay.
func (*Overlay) SendConnections ¶
SendConnections sends all connections an event.
func (*Overlay) SendConnectionsExcept ¶
func (o *Overlay) SendConnectionsExcept(except *Connection, message []byte)
SendConnectionsExcept sends all connections except one an event.
func (*Overlay) UnregisterConnection ¶
func (o *Overlay) UnregisterConnection(connection *Connection)
UnregisterConnection unregisters a connection with the overlay.