Skip to content

openEventStream

openEventStream(url, signal): AsyncGenerator<IndexerSseEvent>

Defined in: ootle-indexer/src/event-stream.ts:72

Opens a persistent SSE connection to url using fetch and yields parsed events as an async generator.

Works in browsers (Fetch + ReadableStream) and Node.js ≥ 18. Automatically reconnects after errors with a 5 s back-off. Stops when signal is aborted.

Mirrors the EventStream / into_stream() pattern from the Rust ootle-rs crate.

string

AbortSignal

AsyncGenerator<IndexerSseEvent>

(caught + logged by the retry loop) if the SSE endpoint returns a non-success status.