Server-Sent Events
ELI5 — The Vibe Check
Server-Sent Events (SSE) is like subscribing to a news feed from the server. You open one connection, and the server keeps sending you updates whenever something new happens — but unlike WebSocket, it's one-way: only the server talks, you just listen. Perfect for live dashboards and notifications.
Real Talk
Server-Sent Events is a server push technology where the client opens a persistent HTTP connection and the server streams events (text data) over it. Unlike WebSockets, SSE is unidirectional (server to client only), uses standard HTTP, and automatically reconnects. Ideal for notifications and live feeds.
Show Me The Code
// Server sends events
res.setHeader('Content-Type', 'text/event-stream');
setInterval(() => {
res.write(`data: ${JSON.stringify({ time: new Date() })}\n\n`);
}, 1000);
When You'll Hear This
"Use SSE for the live order status updates." / "SSE is simpler than WebSocket for one-way real-time updates."
Related Terms
Long Polling
Long polling is a hack to fake real-time updates before WebSocket existed. Your client asks 'any new messages?
Pub/Sub (Pub/Sub)
Pub/Sub is like a newspaper service. Publishers write articles and drop them off.
SSE (Server-Sent Events)
SSE is just the abbreviation for Server-Sent Events. Same thing — the server streams updates to you over a persistent connection.
WebSocket
WebSocket is like upgrading a walkie-talkie from push-to-talk to a full phone call.