Documentation
¶
Overview ¶
Package pubsub implements PUBLISH/SUBSCRIBE with exact channels and glob patterns.
Index ¶
- type Hub
- func (h *Hub) Channels(pattern string) []string
- func (h *Hub) Count(s Subscriber) int
- func (h *Hub) HasSubscribers() bool
- func (h *Hub) NumPat() int
- func (h *Hub) NumSub(channel string) int
- func (h *Hub) PSubscribe(s Subscriber, patterns ...string) []resp.Value
- func (h *Hub) PUnsubscribe(s Subscriber, patterns ...string) []resp.Value
- func (h *Hub) Publish(channel, msg string) int
- func (h *Hub) RemoveAll(s Subscriber)
- func (h *Hub) Subscribe(s Subscriber, channels ...string) []resp.Value
- func (h *Hub) Unsubscribe(s Subscriber, channels ...string) []resp.Value
- type Subscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
func (*Hub) Count ¶
func (h *Hub) Count(s Subscriber) int
Count returns how many channels + patterns s is subscribed to.
func (*Hub) HasSubscribers ¶
HasSubscribers is a lock-free check used to skip building events nobody listens to.
func (*Hub) PSubscribe ¶
func (h *Hub) PSubscribe(s Subscriber, patterns ...string) []resp.Value
PSubscribe adds patterns and returns the "psubscribe" confirmation replies.
func (*Hub) PUnsubscribe ¶
func (h *Hub) PUnsubscribe(s Subscriber, patterns ...string) []resp.Value
PUnsubscribe removes patterns (all if none given).
func (*Hub) RemoveAll ¶
func (h *Hub) RemoveAll(s Subscriber)
RemoveAll drops every subscription of s (on disconnect).
func (*Hub) Subscribe ¶
func (h *Hub) Subscribe(s Subscriber, channels ...string) []resp.Value
Subscribe adds channels and returns the "subscribe" confirmation replies.
func (*Hub) Unsubscribe ¶
func (h *Hub) Unsubscribe(s Subscriber, channels ...string) []resp.Value
Unsubscribe removes channels (all if none given).