Streaming & Upload
Core's callApiStream reads NDJSON responses as line-by-line JSON and emits them in order from the Observable.
Direct usage of callApiStream in Core.
Use callApiStream when the server returns NDJSON (one JSON per line). If the Accept header is not present, it defaults to application/x-ndjson, and other media types can be overridden with per-request headers.
NDJSON response format.
callApiStreamSplits the response based on line breaks and parses each line as JSON. It expects NDJSON, not the standard SSE data: frame format.
Observable subscription and unsubscription.
Calling unsubscribe() will also cancel the internal ReadableStream reader. Unsubscribe in React effects or cleanup tasks.
Optional: Use the generated stream service.
In projects using the OpenAPI generator, you can make the generated service call callApiStream for the stream endpoint. It can be imported and subscribed to in the same way as a regular generated service.