Skip to content
uencoder

Server-Sent Events

SSE (Server-Sent Events) is a lightweight HTTP protocol for one-way server push, streaming events to the browser continuously over text/event-stream.

Purpose

For server-to-client-only push it offers a simpler native browser API than WebSocket, with automatic reconnection.

Mechanism

The response uses Content-Type: text/event-stream and streams event blocks made of data: lines (with id/event/data fields). The browser's EventSource API reconnects automatically and resumes via Last-Event-ID.

Use cases

  • Real-time notifications and news
  • Log streaming
  • Stock tickers

Related tools

References