Node.js Course
Node.js
/
Intermediate

Server Sent Events (SSE)

Definition

A standard describing how servers can initiate data transmission towards clients once an initial client connection has been established. It is built on top of standard HTTP.

Explain Like I'm New

WebSockets are a two-way phone call. Server Sent Events (SSE) is a radio broadcast. The client tunes in (connects via HTTP), and then strictly LISTENS. The server continuously pushes updates down the line, but the client cannot talk back over that same line.

Real World Example

A Live Sports Scoreboard or a Twitter Feed. The user doesn't need to send data to the server at 60 frames per second; they just need to watch the score update live. SSE is perfect for this, and much easier to setup than full WebSockets.

Common Use Cases

  • •Live feeds/timelines
  • •Push notifications
  • •Real-time dashboards

Interactive Example

Loading...
Console output will appear here...

Interview Questions

basic

  • Are Server Sent Events bidirectional (two-way)?

intermediate

  • What protocol does SSE use?

Flash Cards

Question

Bidirectional?

Click to reveal answer
Answer

No. SSE is strictly unidirectional (Server -> Client only).

Question

What protocol?

Click to reveal answer
Answer

Standard HTTP! Unlike WebSockets which require a special `ws://` protocol upgrade, SSE works over standard `http://`. This makes it vastly easier to configure through firewalls and load balancers.