What Is Server-Sent Events (SSE)?
Server-Sent Events is a standard that lets a server push a continuous stream of text-based updates to a client over a single, long-lived HTTP connection, usi...
Published October 9, 2026
Server-Sent Events (SSE) let a server push a stream of text events to the browser over a single HTTP connection. It is one-way, built into browsers via EventSource, and reconnects automatically.
The concept
The server responds with Content-Type: text/event-stream and keeps the connection open, writing lines like data: ... followed by a blank line.
It is simpler than WebSocket for notifications, live feeds and progress updates because it needs no special protocol.
One request, many events
Practical examples
Browser
const es = new EventSource('/stream')
es.onmessage = (e) => console.log(JSON.parse(e.data))
es.addEventListener('done', () => es.close())Node server
app.get('/stream', (req, res) => {
res.set({ 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache', Connection: 'keep-alive' })
const t = setInterval(() => res.write(`data: ${JSON.stringify({ t: Date.now() })}\n\n`), 1000)
req.on('close', () => clearInterval(t))
})Event format
event: price
data: {"btc": 64000}
Common mistakes
- Proxies buffering the response and delaying events.
- Forgetting to clean up on client disconnect.
- Using SSE when you need client-to-server messages.
Key takeaways
- One-way push over HTTP.
- Auto reconnect built in.
- Great for feeds and progress.
FAQ
SSE vs WebSocket?
SSE is simpler and one-way; WebSocket is bidirectional.
Connection limits?
Browsers limit parallel HTTP/1.1 connections per host; HTTP/2 avoids that.