Server Sent Events
Stream saga responses over a single HTTP connection using /api/stream.
Last updated
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.
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.
/api/stream/... returns text/event-stream. Response format negotiation (XML/HTML/CSV) applies to /api/request/... endpoints. See Response Formats.
The gateway runs a simple poll-and-stream loop. The backend controls the loop using a few response fields.
previous (optional): cursor from the prior iteration.
Not present on the first call.
Set to the last seen next value.
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.
Notifications feed: return new notifications in list, set continue: true.
Live monitoring: stream changing metrics or health events as individual list items.
Cursor iteration: return next tokens to page through large datasets safely.
Last updated
