Skip to content

Streaming Endpoint

Opens a persistent Server-Sent Events (SSE) connection that delivers flag configuration changes in real time.

GET /stream
Authorization: Bearer <sdk-key>
Accept: text/event-stream

The stream emits two event types:

Sent every 30 seconds to keep the connection alive.

event: ping
data: {"timestamp":"2026-02-16T15:30:00Z"}

Sent when any flag or segment configuration changes in the environment.

event: flag.updated
data: {"key":"dark-mode","version":4,...}

The data payload contains the updated flag configuration in the same FlagDto shape described in the Flags reference.

  • 401 Unauthorized — Invalid or missing SDK key. The connection is rejected.
  • Prefer streaming over polling. The SSE connection delivers updates within seconds of a change, while polling introduces latency equal to the poll interval.
  • Reconnect on disconnect. If the connection drops, reconnect with exponential backoff. The EventSource API in browsers handles this automatically.
  • Merge updates into the local cache. When you receive a flag.updated event, update the corresponding flag in your in-memory store. SDKs should not need to re-fetch the full configuration.
  • Handle ping silently. Ping events exist only to keep the connection open through proxies and load balancers. No action is needed.
  • Browser limitation: The browser EventSource API does not support custom headers. If your SDK runs in a browser, pass the SDK key as a query parameter or use the polling strategy instead.