topic
Verified 2026-09-18

Server-Sent Events

Server-Sent Events provides a one-way event stream from a server to a browser over HTTP.

Return text/event-stream, keep the connection open, send event records separated by blank lines, and use event IDs when clients should resume with Last-Event-ID.

httprealtimestreamingbrowser

Reference (http)

Content-Type: text/event-stream
Cache-Control: no-cache

data: {"ready":true}

Return text/event-stream, keep the connection open, send event records separated by blank lines, and use event IDs when clients should resume with Last-Event-ID.

Common mistakes

  • Buffering the stream in a proxy or forgetting that the browser reconnects after a dropped connection.
Permalink: https://merginit.com/reference/http/server-sent-events