---
title: "What is SSE?"  
description: "What is SSE?"  
author: "ICSM Computer"  
published: 2025-12-11  
updated: 2025-12-11  
canonical: https://www.mindstick.com/interview/34423/what-is-sse  
category: "technology"  
tags: [".net", "technology"]  
reading_time: 3 minutes  

---

# What is SSE?

> #### SSE = Server-Sent Events
>
> \
> It is a **one-way real-time communication method** where the **server continuously pushes data to the browser** over a single long-lived HTTP connection.

Think of SSE as:

![What is SSE?](https://www.mindstick.com/interviewquestion/634913de-34c3-4f1d-a1fa-f362d9352d28/images/cdae3292-8e8d-4ae0-9f0c-82bbe5f90958.png)

### Server → Browser (only one-way) live updates

Not two-way like WebSockets.

## How SSE works (simple explanation)

- Browser opens a connection:

```plaintext
const es = new EventSource('/stream');
```

- Server keeps the connection open and keeps sending events:

```plaintext
data: Hello user
data: New message arrived
data: Notification updated
```

- Browser receives them instantly as they come.

## Where SSE is used?

- Live notifications
- Chat message updates (receive only)
- Live counters, analytics
- Stock tickers
- Live logs
- News feed updates
- Dashboard updates

## SSE vs WebSocket

| Feature | SSE | WebSocket |
| --- | --- | --- |
| Direction | **One-way (Server → Client)** | Two-way |
| Transport | HTTP | TCP |
| Reconnection | Built-in automatic | Must implement |
| Binary data | No | Yes |
| Simpler | Yes | More complex |

## Example

### Server sends:

```plaintext
data: New notification for user 123
```

### Browser receives:

```plaintext
es.onmessage = (e) => console.log(e.data);
```

## Why choose SSE over WebSocket?

SSE is better when:

- You only need server → browser updates
- Lightweight notifications
- You want automatic reconnection
- You want simpler code and less overhead
- API-driven architecture already uses HTTP

## Answers

### Answer by ICSM Computer

> #### SSE = Server-Sent Events
>
> \
> It is a **one-way real-time communication method** where the **server continuously pushes data to the browser** over a single long-lived HTTP connection.

Think of SSE as:

![What is SSE?](https://www.mindstick.com/interviewquestion/634913de-34c3-4f1d-a1fa-f362d9352d28/images/cdae3292-8e8d-4ae0-9f0c-82bbe5f90958.png)

### Server → Browser (only one-way) live updates

Not two-way like WebSockets.

## How SSE works (simple explanation)

- Browser opens a connection:

```plaintext
const es = new EventSource('/stream');
```

- Server keeps the connection open and keeps sending events:

```plaintext
data: Hello user
data: New message arrived
data: Notification updated
```

- Browser receives them instantly as they come.

## Where SSE is used?

- Live notifications
- Chat message updates (receive only)
- Live counters, analytics
- Stock tickers
- Live logs
- News feed updates
- Dashboard updates

## SSE vs WebSocket

| Feature | SSE | WebSocket |
| --- | --- | --- |
| Direction | **One-way (Server → Client)** | Two-way |
| Transport | HTTP | TCP |
| Reconnection | Built-in automatic | Must implement |
| Binary data | No | Yes |
| Simpler | Yes | More complex |

## Example

### Server sends:

```plaintext
data: New notification for user 123
```

### Browser receives:

```plaintext
es.onmessage = (e) => console.log(e.data);
```

## Why choose SSE over WebSocket?

SSE is better when:

- You only need server → browser updates
- Lightweight notifications
- You want automatic reconnection
- You want simpler code and less overhead
- API-driven architecture already uses HTTP


---

Original Source: https://www.mindstick.com/interview/34423/what-is-sse

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
