Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchTopic ¶
MatchTopic delegates to protocol.MatchTopic.
Types ¶
type EventBridge ¶
type EventBridge struct {
// contains filtered or unexported fields
}
EventBridge subscribes to the event.Bus and fans out matching events to connected WebSocket clients.
func NewEventBridge ¶
func NewEventBridge(bus event.Bus, manager *connections.Manager, subs *store.Subscriptions, allowedPatterns []string) *EventBridge
NewEventBridge creates a new EventBridge.
func (*EventBridge) Start ¶
func (b *EventBridge) Start(ctx context.Context) error
Start subscribes to all allowed event patterns on the event bus. For each incoming event, it fans out to all WebSocket clients subscribed to a matching topic.
func (*EventBridge) SubscribeTopic ¶
func (b *EventBridge) SubscribeTopic(topic string) error
SubscribeTopic dynamically subscribes to an exact topic on the event bus so that events published by other modules are forwarded to WebSocket clients. Wildcard topics (containing * or **) are silently skipped because Watermill requires exact topic names — glob matching is handled at the WebSocket subscription store level. If allowedPatterns is configured, the topic must match at least one pattern.
type MessageHandler ¶
MessageHandler processes an incoming client message for a specific type.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router dispatches incoming client messages to registered handlers by type.
func (*Router) Dispatch ¶
Dispatch routes a parsed message to the registered handler. Returns false if no handler is registered for the message type.
func (*Router) Register ¶
func (r *Router) Register(msgType protocol.MessageType, handler MessageHandler)
Register adds a handler for a message type.