Anik Sikder
Technical Writing/system-design/server-sent-events-sse-when-the-web-learned-to-listen
article.sh

$ open article

system-design

Server-Sent Events (SSE) Explained: When the Web Learned to Listen

11 min read•July 27, 2026
Server-Sent Events Real-Time Streaming Visualization

Hey developers! šŸ‘‹

Welcome back to our journey through communication patterns in distributed systems.

For years, the web operated on a simple principle:

code
Browser asks.
Server answers.
Connection closes.

This model worked perfectly when websites were mostly documents.

A user opened a page.

The browser requested data.

The server responded.

Everyone moved on.

But then the internet changed.

Businesses wanted live stock prices.

Operations teams wanted real-time monitoring dashboards.

Support agents wanted instant notifications.

Users expected applications to update the moment something happened.

The old request-response model suddenly felt too slow.

The challenge wasn't generating updates.

The challenge was delivering those updates immediately.

And that led engineers down an interesting path:

code
Request-Response
        ↓
Polling
        ↓
Long Polling
        ↓
Server-Sent Events (SSE)

SSE wasn't just another communication technique.

It was the web's attempt to become truly real-time while staying inside the familiar world of HTTP.


A Quick Recap: Why Long Polling Wasn't Enough

Long Polling was a major improvement over traditional Polling.

Instead of asking repeatedly:

code
Anything new?

the client said:

code
Tell me when something changes.

The server waited.

When an event occurred:

code
Server Responds
       ↓
Client Creates New Request
       ↓
Server Waits Again

Much more efficient.

But there was still a pattern hiding underneath.

Every update required:

code
Response
   ↓
Reconnect
   ↓
Wait Again

The browser was still responsible for repeatedly initiating communication.

Just less frequently.

Engineers started wondering:

What if the browser only connected once?


The Simple Question That Changed Everything

Imagine a support dashboard.

A stock market application.

An AI assistant.

A monitoring platform.

All of them share the same behavior:

code
Server Knows When Something Changes

So why does the client keep asking?

Instead of:

code
Client:
Anything new?

Server:
No.

What if the browser simply said:

code
I'm listening.

And stayed connected?

That idea became Server-Sent Events.


What Is Server-Sent Events (SSE)?

Server-Sent Events is a communication pattern where a browser opens a single HTTP connection and keeps it alive.

Instead of repeatedly requesting updates, the browser listens.

The server sends data whenever new information becomes available.

code
Browser
     │
     │ Open Connection
     ā–¼
Server
     │
     ā”œā”€ā”€ Event
     ā”œā”€ā”€ Event
     ā”œā”€ā”€ Event
     └── Event

The browser becomes a subscriber.

The server becomes a publisher.

No polling loop.

No repeated requests.

No constant reconnecting after every update.


Think of SSE Like a News Subscription

Imagine subscribing to a news service.

Polling looks like this:

code
You:
Any news?

Publisher:
No.

You:
Any news?

Publisher:
No.

You:
Any news?

SSE looks like this:

code
You:
Send me news whenever it happens.

Publisher:
Understood.

Hours later:

code
Breaking News
      │
      ā–¼
Notification Delivered

You don't repeatedly check.

The publisher contacts you when something important occurs.

That's the core idea behind SSE.


What Actually Happens Under the Hood?

From the browser's perspective, opening an SSE connection is surprisingly simple.

code
const events = new EventSource("/events");

The browser sends a normal HTTP request.

The server responds with a special content type:

code
text/event-stream

Unlike a normal HTTP response, the connection remains open.

Instead of returning a complete response and closing:

code
Request
   ↓
Response
   ↓
Close

the server continuously streams events:

code
data: New Order Created

data: Payment Received

data: Shipment Dispatched

The browser receives events immediately.

The stream stays alive.

The connection remains open.


A Visual Mental Model

Long Polling

code
Request
   │
Wait
   │
Response
   │
Reconnect
   │
Wait Again

SSE

code
Connect Once
      │
Listen
      │
Event
      │
Event
      │
Event
      │
Still Listening

The difference seems small.

Architecturally, it's significant.


Real System Example: E-Commerce Dashboard

Imagine a large e-commerce platform.

Operations teams monitor incoming orders.

Without SSE:

code
Dashboard
    │
Poll Every 5 Seconds
    │
Check For Orders

A customer places an order.

The dashboard updates several seconds later.

With SSE:

code
Customer Places Order
          │
          ā–¼
Order Service
          │
          ā–¼
Notification Service
          │
          ā–¼
SSE Stream
          │
          ā–¼
Dashboard

The moment an order is created:

code
New Order Received

appears instantly.

To users:

code
The System Feels Alive

Real System Example: Monitoring Platforms

Modern monitoring tools display:

  • CPU usage
  • Memory usage
  • Error rates
  • Latency
  • Active users

These metrics change constantly.

Polling every few seconds creates unnecessary traffic.

Instead:

code
Monitoring Agent
       │
       ā–¼
Metrics Service
       │
       ā–¼
Event Stream
       │
       ā–¼
SSE
       │
       ā–¼
Dashboard

As metrics change, updates appear immediately.

Operations teams gain near real-time visibility into system health.


Real System Example: AI Response Streaming

One of the most recognizable uses of SSE today is AI.

When you ask an AI assistant a question, the model doesn't generate an entire answer instantly.

It generates tokens gradually.

Without streaming:

code
Question
    │
Wait 10 Seconds
    │
Entire Response Appears

Users experience:

code
Silence

With SSE:

code
Question
    │
Short Wait
    │
Words Begin Appearing
    │
More Words
    │
More Words

The total generation time may be identical.

But the experience feels dramatically faster.

This reveals an important design principle:

Users experience latency differently than systems measure latency.

A ten-second delay feels slow.

A ten-second stream feels interactive.

SSE helps bridge that gap.


Why Product Teams Love SSE

Product teams rarely ask:

Is this protocol elegant?

They ask:

Does the product feel responsive?

Compare:

code
Click
  │
Wait
  │
Wait
  │
Wait
  │
Response

Versus:

code
Click
  │
Response Starts
  │
More Content
  │
More Content

The second experience feels significantly faster.

That often translates into:

  • Better engagement
  • Higher retention
  • Increased trust
  • Improved customer satisfaction

The implementation details are invisible.

The user experience isn't.


Why Developers Love SSE

One reason SSE became popular is its simplicity.

It works with existing HTTP infrastructure.

code
Browser
   │
HTTP
   │
Load Balancer
   │
Reverse Proxy
   │
Application Server

No entirely new protocol.

No custom client libraries.

No complicated connection management.

Developers also benefit from automatic reconnection.

If the connection drops:

code
Connection Lost
       │
       ā–¼
Browser Detects Failure
       │
       ā–¼
Automatic Reconnect

Many recovery scenarios are handled automatically.

Less code.

Fewer edge cases.

Simpler implementations.


Why Architects Choose SSE

A common question appears:

Why not just use WebSockets?

Because not every system needs two-way communication.

Consider:

code
Stock Market
      │
      ā–¼
Browser

Or:

code
Monitoring System
       │
       ā–¼
Dashboard

Or:

code
AI Model
      │
      ā–¼
User Interface

All of these follow:

code
Server
   ↓
Client

The server sends most of the information.

The client mostly listens.

SSE fits naturally.

One of the most important architecture lessons is:

The best solution isn't the most powerful one. It's the simplest one that satisfies the requirements.

For many one-way streaming systems, SSE is exactly that solution.


The Hidden Challenge

Every architectural improvement introduces a new bottleneck.

Polling created:

code
Too Many Requests

SSE dramatically reduces that problem.

But it introduces another:

code
Persistent Connections

Imagine:

code
500,000 Active Users

Polling might create:

code
Millions of Requests Per Minute

SSE creates:

code
500,000 Open Connections

The request problem improves.

Connection management becomes the new challenge.

Infrastructure teams start thinking about:

  • Memory usage
  • File descriptor limits
  • Load balancer behavior
  • Proxy timeouts
  • Reconnection storms
  • Horizontal scaling

An important lesson emerges:

code
Fewer Requests
≠
Less Work

The workload simply shifts.


SSE vs Long Polling

FeatureLong PollingSSE
CommunicationServer → ClientServer → Client
Connection ModelRepeated RequestsSingle Persistent Stream
Reconnection FrequencyFrequentRare
Infrastructure OverheadModerateLower
Browser SupportExcellentExcellent
Automatic ReconnectManual LogicBuilt-In
Streaming ExperienceGoodExcellent

Both approaches solve real problems.

SSE simply removes another layer of overhead.


Where SSE Starts To Break Down

SSE excels at one-way communication.

But some systems require:

code
Client ↔ Server

continuous communication.

Examples include:

  • Chat applications
  • Multiplayer games
  • Collaborative editors
  • Trading systems
  • Video conferencing

These applications need both sides to speak freely.

SSE only provides:

code
Server → Client

communication.

At that point, WebSockets usually become the better choice.


The Architect's Lesson

SSE teaches a powerful principle:

Stop asking repeatedly. Start listening continuously.

That small shift helped transform the web from a collection of pages into a platform for real-time experiences.

Stock prices could update instantly.

Dashboards could refresh automatically.

Notifications could arrive immediately.

AI systems could stream responses as they were generated.

The technology itself is relatively simple.

The impact on user experience is enormous.

And that is often the hallmark of great system design:

Small architectural changes can create massive user experience improvements.


TL;DR Quick Recap

  • SSE allows browsers to maintain a single HTTP connection.
  • The server streams updates whenever events occur.
  • Clients listen instead of repeatedly polling.
  • SSE is ideal for one-way real-time communication.
  • It works well for dashboards, notifications, stock prices, and AI streaming.
  • It leverages existing HTTP infrastructure.
  • Persistent connections introduce new scaling considerations.
  • SSE sits between Long Polling and WebSockets in the evolution of real-time web communication.

Final Thoughts: The Web Learned to Listen 🧠

Polling taught the web how to ask.

Long Polling taught the web how to wait.

SSE taught the web how to listen.

That change may sound subtle.

But it fundamentally altered how users interact with modern applications.

The web was no longer a collection of pages that occasionally refreshed.

It became a platform capable of delivering information the moment it existed.

For many systems, that was enough.

For others, the journey continued.

Because eventually developers wanted something more than listening.

They wanted a conversation.

And that conversation led to:

WebSockets.


A Little Engineering Joke to End On šŸ˜„

Why did SSE become a great listener?

Because unlike Polling,

it stopped interrupting every few seconds.


Frequently Asked Questions

What is Server-Sent Events (SSE)?

SSE is a browser technology that allows servers to continuously stream updates to clients over a single HTTP connection.


How is SSE different from Polling?

Polling repeatedly asks for updates.

SSE opens one connection and receives updates whenever the server has new information.


How is SSE different from Long Polling?

Long Polling repeatedly creates new waiting requests.

SSE maintains one persistent stream for continuous event delivery.


Is SSE real-time?

For many applications, yes.

Updates are typically delivered immediately after events occur.


Why is SSE commonly used for AI applications?

Because AI responses are generated incrementally and can be streamed token-by-token, creating a more responsive user experience.


When should I use SSE?

SSE is ideal when:

  • Data primarily flows from server to client
  • Real-time updates are important
  • HTTP compatibility matters
  • Simplicity is preferred over bidirectional communication

Key Takeaways

  • SSE enables server-to-client streaming over HTTP.
  • Clients listen instead of repeatedly polling.
  • It reduces unnecessary requests.
  • It improves perceived responsiveness.
  • It works exceptionally well for dashboards, notifications, monitoring, and AI streaming.
  • Persistent connections introduce new operational challenges.
  • SSE is often the simplest solution for one-way real-time communication.
  • Understanding SSE helps explain the evolution toward modern web communication patterns.

If you found this article useful, share it with fellow backend engineers, system architects, platform engineers, and distributed systems enthusiasts exploring communication patterns at scale.


About the Author

Anik Sikder is a Software Engineer specializing in Backend Systems, SaaS Architecture, Cloud Infrastructure, Python, Django, FastAPI, distributed systems, and scalable software engineering.

He writes about system design, networking, distributed systems, cloud computing, software architecture, and modern engineering practices.

$ tags

sseserver-sent-eventsdistributed-systemssoftware-architecturesystem-designweb-architecturerealtime-systemsbackend-engineeringcommunication-patternsstreaming

$ ls related_articles

status: end_of_file