Documentation ¶
Overview ¶
Package topic provides implementations of server-side topics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is a struct responsible for finding topics. Topics are not created by the package user, rather they are created on demand by the topic manager.
type Subscription ¶
type Subscription interface { // Send a message frame to the topic subscriber. SendTopicFrame(f *frame.Frame) }
Subscription is the interface that wraps a subscriber to a topic.
type Topic ¶
type Topic struct {
// contains filtered or unexported fields
}
A Topic is used for broadcasting to subscribed clients. In contrast to a queue, when a message is sent to a topic, that message is transmitted to all subscribed clients.
func (*Topic) Enqueue ¶
Enqueue send a message to the topic. All subscriptions receive a copy of the message.
func (*Topic) Subscribe ¶
func (t *Topic) Subscribe(sub Subscription)
Subscribe adds a subscription to a topic. Any message sent to the topic will be transmitted to the subscription's client until unsubscription occurs.
func (*Topic) Unsubscribe ¶
func (t *Topic) Unsubscribe(sub Subscription)
Unsubscribe causes a subscription to be removed from the topic.