Skip to main content
Definition Website Computer and Technology

Server-Sent Events

Subject: Computer and Technology noun /ˈsɜːr.vər ˌsɛnt ɪˈvɛnts/ 1 definition

  1. Definition (noun)

    Entry #173 · Updated

    Server-Sent Events (SSE) is a standardized web technology that allows a server to push asynchronous, UTF-8 text messages to a client over a single, long-lived HTTP connection formatted with the text/event-stream media type. In browsers, applications subscribe to the stream using the native EventSource API, which automatically parses incoming frames, handles reconnect delays, and resumes missed events via Last-Event-ID headers. Unlike full-duplex WebSockets or repeated HTTP polling, SSE is strictly unidirectional from server to client over standard HTTP, making it lightweight and firewall-friendly whenever only downstream updates are needed.

    Common Forms

    • Standard EventSource Streams: Browser-managed GET subscriptions built on the EventSource interface, providing native frame parsing, server-controlled retry: intervals, and automatic reconnection without third-party libraries.

    • Fetch-Based POST Streams: Custom streaming consumers built on fetch() and ReadableStream that parse text/event-stream responses when request bodies or custom authorization headers are required, such as streaming LLM completions.

    • Named Event Streams: Streams that pair data: payloads with custom event: fields so a single connection can multiplex distinct update types and route them to dedicated client listeners.

    • HTTP/2-Multiplexed Streams: SSE endpoints served over HTTP/2 or HTTP/3 multiplexing, allowing multiple concurrent streams to share one underlying transport connection and avoid HTTP/1.1's six-connection-per-origin browser limit.

    Example

    During a production rollout, a CI/CD dashboard opens an EventSource connection to /deployments/842/logs, receiving Content-Type: text/event-stream frames containing id: 19 and data: {"step":"migrate","status":"ok"} as each build stage finishes. When the user's connection drops momentarily, the browser automatically reconnects and sends a Last-Event-ID: 19 header so the server resumes streaming from the next log entry without duplicating earlier output.