Documentation ¶
Index ¶
- type IPubSub
- type PubSub
- func (ps *PubSub) Close(topic, channelID string)
- func (ps *PubSub) CloseTopic(topic string) bool
- func (ps *PubSub) HaveTopic(topic string) bool
- func (ps *PubSub) Listen(topic string, channelID ...string) chan interface{}
- func (ps *PubSub) Publish(topic string, m interface{})
- func (ps *PubSub) Reset()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPubSub ¶
type IPubSub interface { // HaveTopic determines if there are any open pubsub channels for a given topic HaveTopic(topic string) bool // Listen will "subscribe" to a topic and return a channel that will receive // any messages that are published to that topic. Listen accepts an optional // identifier that will be used to identify a specific listener. The identifier // is useful for being able to close a _specific_ channel. Listen(topic string, channelID ...string) chan interface{} // Publish will publish a message to a topic, which may have multiple channels associated // with it. Each channel will receive the message Publish(topic string, m interface{}) // Close will delete the channel from the topic map and close the channel. // WARNING: Make sure to call Close() only on listeners that no longer Listen()'ing Close(topic, channelID string) // CloseTopic is used when a tail request is stopped to close all associated channels // and prevent a dead-lock CloseTopic(topic string) bool // Reset will delete all channels from the topic map and close all channels; // use this when you are finished Reset() }
IPubSub is an interface for an internal, in-memory pub/sub system. We use it to signal events to subscribers (such as when new clients Register() to the server or when disconnects occur). This is used to tell the frontend that a change has occurred (and the frontend must refresh its view.
Click to show internal directories.
Click to hide internal directories.