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
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 is ideal for live dashboards, notification streaming, prices, and task progress.