Skip to main content

Basic usage

The async iterator closes automatically on terminal status, so a plain for await is enough.

Event object

Listeners

Reconnection

Built-in. Backoff 1s, 2s, 5s, 15s, 30s, 30s.... On reconnect we send Last-Event-ID so you don’t lose events as long as the gap stays under 60 seconds (the server’s ring buffer window).

Degraded polling fallback

After 5 consecutive failed reconnects, the SDK switches to polling GET /order/{id} every 10 s and emits a degraded event. It will keep trying to upgrade back to SSE in the background every 60 s. Disable this with:

Manual close

Concurrency

Each streamOrder() call counts as one SSE connection against your tier cap. Use a single stream per order — fan out internally with an EventEmitter if multiple consumers need the same data.