Documentation
¶
Overview ¶
Package pubsub provides a simple publish-subscribe mechanism for GraphQL subscriptions.
Index ¶
- type PubSub
- func (ps *PubSub) Publish(topic Topic, filter string, message interface{})
- func (ps *PubSub) PublishAll(topic Topic, message interface{})
- func (ps *PubSub) Subscribe(topic Topic, filter string, bufferSize int) *Subscriber
- func (ps *PubSub) SubscriberCount(topic Topic) int
- func (ps *PubSub) Unsubscribe(sub *Subscriber)
- type Subscriber
- type Topic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PubSub ¶
type PubSub struct {
// contains filtered or unexported fields
}
PubSub manages subscriptions and message distribution.
func (*PubSub) Publish ¶
Publish sends a message to all subscribers of a topic. If filter is non-empty, only sends to subscribers with matching filter or empty filter.
func (*PubSub) PublishAll ¶
PublishAll sends a message to all subscribers of a topic regardless of filter.
func (*PubSub) Subscribe ¶
func (ps *PubSub) Subscribe(topic Topic, filter string, bufferSize int) *Subscriber
Subscribe creates a new subscription for a topic.
func (*PubSub) SubscriberCount ¶
SubscriberCount returns the number of subscribers for a topic.
func (*PubSub) Unsubscribe ¶
func (ps *PubSub) Unsubscribe(sub *Subscriber)
Unsubscribe removes a subscription.
type Subscriber ¶
type Subscriber struct {
ID string
Topic Topic
Filter string // Optional filter value (e.g., projectId, universe)
Channel chan interface{}
}
Subscriber represents a subscription channel.
type Topic ¶
type Topic string
Topic represents a subscription topic.
const ( TopicDMXOutput Topic = "DMX_OUTPUT_CHANGED" TopicProjectUpdated Topic = "PROJECT_UPDATED" TopicPreviewSession Topic = "PREVIEW_SESSION_UPDATED" TopicCueListPlayback Topic = "CUE_LIST_PLAYBACK_UPDATED" TopicSystemInfo Topic = "SYSTEM_INFO_UPDATED" TopicWiFiStatus Topic = "WIFI_STATUS_UPDATED" )
Click to show internal directories.
Click to hide internal directories.