Skip to content

Server-Sent Events

Medium — good to knowBackend

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."

Made with passive-aggressive love by manoga.digital. Powered by Claude.