Documentation
¶
Overview ¶
Package sse provides Server-Sent Events support for real-time updates.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broadcaster ¶
type Broadcaster struct {
// contains filtered or unexported fields
}
Broadcaster manages Server-Sent Events connections.
func NewBroadcaster ¶
func NewBroadcaster(logger *zerolog.Logger) *Broadcaster
NewBroadcaster creates a new SSE broadcaster.
func (*Broadcaster) Broadcast ¶
func (b *Broadcaster) Broadcast(event Event)
Broadcast sends an event to all connected SSE clients.
func (*Broadcaster) ClientCount ¶
func (b *Broadcaster) ClientCount() int
ClientCount returns the number of connected SSE clients.
func (*Broadcaster) Run ¶
func (b *Broadcaster) Run(ctx context.Context)
Run starts the broadcaster's main loop. Should be called in a goroutine. The broadcaster will run until the context is cancelled.
func (*Broadcaster) ServeHTTP ¶
func (b *Broadcaster) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles SSE connections.
Click to show internal directories.
Click to hide internal directories.