Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrTopicAlreadyClosed = errors.New("topic is already closed")
ErrTopicAlreadyClosed returns when the topic is already closed.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub interface {
// Pub publishes message.
Pub(topic string, msg interface{})
// Sub adds subscription and returns channel to subscribe.
Sub(topic string) <-chan interface{}
// Unsub removes subscription corresponding to the submitted channel.
Unsub(topic string, ch <-chan interface{})
// PSub adds pattern subscriptions and returns channel to subscribe.
PSub(pattern string) <-chan interface{}
// PUnsub removes pattern subscription corresponding to the submitted channel.
PUnsub(pattern string, ch <-chan interface{})
// Close closes Hub.
Close()
// Context returns context.
Context() context.Context
}
Hub represents PubSubHub.
type Topic ¶
type Topic interface {
// Pub publishes message.
Pub(msg interface{}) error
// Sub adds subscription and returns channel to subscribe.
Sub() (<-chan interface{}, error)
// Unsub removes subscription corresponding to the submitted channel.
Unsub(ch <-chan interface{}) error
// SubLen returns length of subscribers.
SubLen() int
// Close closes Topic.
Close()
// Context returns context.
Context() context.Context
}
Topic represents message publish/subscribe interface for one topic.
Click to show internal directories.
Click to hide internal directories.