📡 Real-Time Streaming Reference

Master Server-Sent Events
& Real-Time Streaming

The definitive technical reference for full-stack engineers building real-time systems. Eighty-five in-depth guides: protocol internals and the event stream format, HTTP/2 and HTTP/3, proxy and CDN configuration, backend generation in Node.js, Python and Go with Redis fan-out, observability and edge deployment, and client patterns from React and Vue hooks to token-streamed AI responses.

What You'll Find Here

Server-Sent Events (SSE) provide a standardised, unidirectional HTTP streaming protocol purpose-built for server-to-client real-time communication. Unlike WebSockets or long-polling, SSE operates over plain HTTP/1.1 or HTTP/2, requires no protocol upgrade, and delivers automatic reconnection with cursor tracking out of the box through the browser's native EventSource API.

This site covers the full production stack across three sections. SSE protocol fundamentals dig into the event stream format, event IDs and retry, HTTP/2 and HTTP/3 multiplexing, proxy and CDN configuration, security headers, and cross-browser support. Backend stream generation covers serving SSE from Node.js, Python/FastAPI and Go — with connection pooling, buffer management, Redis pub/sub fan-out, rate limiting and backpressure, idempotent event IDs, observability, and edge and serverless deployment. Frontend consumption covers React and Vue EventSource hooks, state-management integration, streaming AI responses token by token, reconnection UX, and mobile background-tab handling.

Whether you're building telemetry dashboards, notification pipelines, live data feeds, or migrating from polling to persistent streams, every guide provides production-grade code examples, edge case mitigations, and actionable deployment directives.

Start Here

Four pages that answer the questions engineers ask first.

Browse by Section

Three comprehensive sections covering the full SSE stack — from protocol internals to backend generation and frontend consumption.

Recent Deep Dives

All Topics

Browser Support & Polyfill Strategies EventSource support matrix, polyfill options, fetch+ReadableStream fallbacks, and tiered degradation patterns for production SSE deployments. Event ID & Retry Mechanism Design How SSE event IDs and retry directives enable deterministic stream resumption: wire format, server-side cursors, backoff design, and production edge cases. HTTP/2 and HTTP/3 for Event Streams How SSE behaves over HTTP/2 and HTTP/3: multiplexing away the six-connection cap, header compression, flow control, QUIC migration, and the settings that matter. Proxy & CDN Configuration for SSE Copy-paste proxy configuration for Server-Sent Events: nginx, HAProxy, Envoy, Caddy, AWS ALB and CDN edges — buffering, timeouts, compression and the settings that break streams. Security Headers for Event Streams Complete guide to HTTP security headers for SSE endpoints: CORS, CSP, auth, X-Accel-Buffering, and production hardening for long-lived streams. SSE vs WebSockets vs HTTP Polling Compare SSE, WebSockets, and HTTP polling on latency, connection overhead, directionality, proxy compatibility, and scaling to pick the right transport. Understanding the Event Stream Format Complete field-by-field reference for the text/event-stream wire format: data, event, id, retry, comments, framing rules, and parser edge cases. Buffer Management & Chunked Transfer Encoding Master HTTP chunked transfer encoding, flush timing, watermark tuning, and proxy buffering bypass for production SSE streams across Node.js, Python, and Go. Connection Pooling for SSE Servers How to manage thousands of long-lived SSE connections: FD limits, worker tuning, pooled sockets, heartbeats, and graceful drain under load. Edge & Serverless SSE Deployment Run Server-Sent Events on edge and serverless runtimes: Web Streams on Workers and Deno, Lambda response streaming, execution-time ceilings, statelessness and cost per open stream. Go Streaming Patterns for SSE Idiomatic Go SSE using http.Flusher, goroutines, channels, context cancellation, and graceful shutdown — with production-ready patterns. HTTP Keep-Alive & Connection Lifecycle How HTTP Keep-Alive, TCP keepalives, heartbeats, and teardown interact for long-lived SSE streams — config, edge cases, and production ops. Idempotent Event ID Generation Assign collision-free, monotonic IDs to SSE events so clients can resume streams after disconnection without duplicates or missed events. Node.js Streaming Architecture Basics Build reliable SSE endpoints in Node.js: headers, res.write, flush, heartbeats, backpressure, disconnect cleanup, and production ops. Observability & Metrics for SSE Instrument long-lived event streams: the metrics that matter, Prometheus and OpenTelemetry wiring, structured logging for connections that outlive requests, and the alerts worth paging on. Python FastAPI SSE Implementation Guide Ship production SSE endpoints with FastAPI: StreamingResponse, async generators, sse-starlette, ASGI tuning, proxy buffering, and scale considerations. Rate Limiting & Backpressure Handling Token-bucket rate limiting, slow-consumer backpressure, and drop policies for SSE servers — Node.js, Go, and Python patterns with production ops. Redis Pub/Sub Fan-Out for SSE Decouple SSE producers from connections using Redis pub/sub. Multi-node broadcast, channel design, at-least-once delivery, and backpressure strategies. Error Handling & Reconnection UX Implement SSE reconnection with exponential backoff, surface connection state to users, handle stale data, and design graceful degradation for unreliable networks. Mobile & Background-Tab Handling Manage SSE connections across Page Visibility changes, mobile tab suspension, battery constraints, and resume with Last-Event-ID to avoid event loss. React EventSource Hooks & State Encapsulate EventSource in React hooks for lifecycle-safe SSE: cleanup, re-render control, error handling, and concurrent-mode compatibility. State-Management Integration for SSE Feed SSE events into Redux, Pinia, and Zustand: action dispatch, normalization, optimistic updates, deduplication, and backpressure patterns. Streaming AI Responses in the Browser Build token-streaming UIs on SSE: incremental rendering, partial markdown, cancellation, backpressure on fast token streams, and resuming a generation after a dropped connection. Vue EventSource Composables Build reactive Vue 3 composables for SSE: useEventSource with ref-based state, onUnmounted cleanup, typed events, and exponential-backoff reconnection.