Documentation
¶
Overview ¶
Package sse provides a dependency-free server-sent events presentation fanout adapter for runtime/contracts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoHub = errors.New("sse hub cannot be nil")
ErrNoHub is returned by helpers that require a hub but receive nil.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub fans presentation events out to connected server-sent events clients.
func (*Hub) ClientCount ¶
ClientCount returns the number of currently connected clients.
func (*Hub) SendPresentationEvents ¶
SendPresentationEvents broadcasts presentation events to connected clients. Non-presentation events are ignored.
type Option ¶
type Option func(*Hub)
Option configures a Hub.
func WithAudienceFromRequest ¶ added in v0.8.0
WithAudienceFromRequest assigns one or more server-owned audience labels to a connecting client. Empty labels make the client receive broadcast events only. Do not read audience labels from client-controlled query parameters without authenticating them first.
func WithBufferSize ¶
WithBufferSize sets each client's queued message buffer. Non-positive values keep the default.