Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSubscription ¶
func NewSubscription() (Publisher, Subscriber)
NewSubscription creates a new event subscription.
Types ¶
type Event ¶
type Event interface { // MarshalToProtobuf maps events into API protobuf events. MarshalToProtobuf() *apigen.Event }
Event represents a node event.
type NewMessage ¶
NewMessage occurs when a new message is received from a subscribed room (pubsub topic).
func (*NewMessage) MarshalToProtobuf ¶
func (e *NewMessage) MarshalToProtobuf() *apigen.Event
type PeerJoined ¶
PeerJoined occurs when a peer joins a room that we are subscribed to.
func (*PeerJoined) MarshalToProtobuf ¶
func (e *PeerJoined) MarshalToProtobuf() *apigen.Event
type PeerLeft ¶
PeerLeft occurs when a peer lefts a room that we are subscribed to.
func (*PeerLeft) MarshalToProtobuf ¶
type Publisher ¶
type Publisher interface { // Publish blocks until it is able to send the event through. Publish(Event) error // Closed checks whether the publisher is closed. Closed() bool }
Publisher defines the event subscription sender interface.
type Subscriber ¶
type Subscriber interface { // Next blocks until an event is received through the subscriber. Next() (Event, error) // Close closes the subscriber so it stops receiving new events. Close() }
Subscriber defines the event subscription receiver interface.
Click to show internal directories.
Click to hide internal directories.