Documentation
¶
Overview ¶
Package async provides a channel-based async event delivery interface with implementations for WebSocket, SSE, Pusher, and Ably.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncNotifier ¶
type AsyncNotifier interface {
// Publish sends an event to all subscribers of the given channel.
Publish(ctx context.Context, channel string, event *Event) error
// Close releases resources held by the notifier.
Close() error
}
AsyncNotifier publishes events to named channels. Implementations may deliver via WebSocket, SSE, Pusher, Ably, or other backends.
type ConnectionAcceptor ¶
type ConnectionAcceptor interface {
// AcceptConnection upgrades an HTTP request to a persistent connection
// and registers it under the given channel and memberID.
// The connection is managed internally; events published to the channel
// will be delivered to this connection.
AcceptConnection(w http.ResponseWriter, r *http.Request, channel, memberID string) error
}
ConnectionAcceptor is an optional interface implemented by backends that require server-side HTTP connection management (WebSocket, SSE). Callers may type-assert an AsyncNotifier to ConnectionAcceptor when they need to accept inbound client connections.
type Event ¶
type Event struct {
Type string `json:"type"`
Data json.RawMessage `json:"data,omitempty"`
}
Event represents an async notification event to be published to a channel.
Click to show internal directories.
Click to hide internal directories.