sse

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct{}

Config holds SSE async notifier configuration.

func (*Config) ValidateWithContext

func (cfg *Config) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a Config struct.

type Notifier

type Notifier struct {
	// contains filtered or unexported fields
}

Notifier is an SSE-backed AsyncNotifier that manages direct client connections. Note that AcceptConnection blocks the calling goroutine for the lifetime of the client connection, as SSE uses the HTTP response writer directly.

func NewNotifier

func NewNotifier(_ *Config, logger logging.Logger, tracerProvider tracing.TracerProvider) (*Notifier, error)

NewNotifier creates a new SSE-backed AsyncNotifier.

func (*Notifier) AcceptConnection

func (n *Notifier) AcceptConnection(w http.ResponseWriter, r *http.Request, channel, memberID string) error

AcceptConnection upgrades the HTTP connection to an SSE stream and registers it under the given channel and memberID. This method blocks the calling goroutine for the lifetime of the client connection.

func (*Notifier) Close

func (n *Notifier) Close() error

Close releases resources held by the notifier.

func (*Notifier) Publish

func (n *Notifier) Publish(ctx context.Context, channel string, event *async.Event) error

Publish sends an event to all connected clients on the given channel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL