Glossary

Server-Sent Events (SSE)

SSE (Server-Sent Events) is a standard browser API for receiving a stream of updates from the server over a regular HTTP connection. Unidirectional: server → client only. Simpler than WebSocket when two-way communication is not needed.

How it works

The client opens a connection via EventSource. The server responds with Content-Type: text/event-stream and keeps the connection open, sending events in the format:

data: {"price": 42.5, "symbol": "BTC"}\n\n

Client-side code

const es = new EventSource('/api/prices');
es.onmessage = (e) => {
  const data = JSON.parse(e.data);
  updatePrice(data.symbol, data.price);
};
es.onerror = () => es.close();

SSE vs WebSocket

SSE is ideal for live dashboards, notification streaming, prices, and task progress.