Server Sent Events
Stream saga responses over a single HTTP connection using /api/stream.
API gateways support Server-Sent Events (SSE) for any backend microservice endpoint.
SSE keeps one HTTP connection open. The gateway then pushes a sequence of events to the client.
Endpoint mapping
You typically already have an API under:
/api/request/[PATH]for a one-shot response.
You can stream the same backend logic by calling:
/api/stream/[PATH]for an SSE feed.
Authentication, request method, and request body stay the same.
How streaming works
The gateway runs a simple poll-and-stream loop. The backend controls the loop using a few response fields.
Request and response fields
Request (gateway → backend runner)
previous(optional): cursor from the prior iteration.Not present on the first call.
Set to the last seen
nextvalue.
Response (backend runner → gateway)
list(optional): array of records to stream.Each entry becomes a separate SSE event.
continue(optional): boolean.When
true, the gateway repeats the request.
wait(optional): wait duration before the next request.Interpreted by the gateway.
Falls back to a gateway default when missing.
next(optional): cursor value for the next iteration.Returned to the backend later as
previous.
Common use cases
Notifications feed: return new notifications in
list, setcontinue: true.Live monitoring: stream changing metrics or health events as individual list items.
Cursor iteration: return
nexttokens to page through large datasets safely.
Last updated
