realtime-streaming
Token streaming from NestJS on Fastify to a browser client - SSE versus WebSocket decision, @Sse with Observable and raw Fastify reply handling, event framing and types (delta, done, error, heartbeat), event IDs and resumable streams via Last-Event-ID with a Redis stream or DB buffer, client disconnect detection and AbortSignal cancellation of upstream LLM calls, backpressure, heartbeats and proxy buffering headers, timeouts, one stream per request, persisting the final message after disconnect, error-after-start semantics, and load limits. Load when building or debugging streaming chat responses, SSE endpoints, resumable streams, or LLM token delivery.
Pinned to revision c74eff4a9f08, so it is the text this page describes rather than whatever the author pushed since.
Files
Every link opens the file at its source, pinned to the revision this page describes.