Connection and behaviour configuration.
The SSE endpoint URL.
Whether the client has been closed.
Snapshot of current stream health (events, reconnects, last event time).
Stream events as an async iterator.
Stream events as an async iterator (explicit method).
Listen for a specific event type (like EventSource.addEventListener). Returns an async iterator that yields only matching events.
Collect all events into an array until the stream closes.
Use with caution on long-lived streams — for infinite streams, prefer
the async iterator interface (for await...of).
Optionallimit?: numberIf provided, stops collecting after this many events. Returns early with partial results.
Optionalsignal?: AbortSignalAbortSignal to cancel collection early.
Array of collected events. Returns empty array if stream ends with no events.
Close the connection and abort any active stream.
Destroy the client and clean up all resources.
SSE client that connects to a text/event-stream endpoint and yields events.
Supports automatic reconnection with exponential backoff + jitter, Last-Event-ID resumption, heartbeat detection, and configurable validation.