Microsoft’s .NET 10 introduces one of its most exciting features yet:
Server-Sent Events (SSE).
This new capability enables developers to stream events directly from a server to a client — without relying on WebSockets, SignalR, or webhooks.
If you’re building APIs or web applications, this feature could simplify real-time data delivery in your projects.

What Are Server-Sent Events?

Server-Sent Events (SSE) allow a server to push updates to a client over a single HTTP GET request.
The communication is unidirectional — meaning data only flows from server to client.

This makes SSE ideal for scenarios like:

  • Stock tickers and live financial data
  • Real-time order tracking in e-commerce apps
  • Notifications and activity streams
  • Live dashboards

Implementing SSE in .NET 10

To demonstrate, let’s start with a simple minimal API in .NET 10.
We’ll create a /live-orders endpoint that streams new order data to clients in real time.

Step 1: Define the Endpoint

Here, instead of returning a standard JSON response, we return server-sent events.

Step 2: Create a Stream of Data

We’ll use an IAsyncEnumerable to continuously generate and return order objects:

Each SseItem contains:

  • Data (in this case, a FoodOrder)
  • Event ID
  • Event type (helps clients filter events)
  • Retry interval (used if the connection drops)

Step 3: Consuming SSE in the Browser

Browsers natively support SSE using the EventSource API.
You only need a few lines of JavaScript:

This setup automatically reconnects if the connection drops, ensuring reliability.

Why Use SSE Instead of WebSockets or SignalR?

While WebSockets and SignalR support
bi-directional communication, many real-time applications only require
server-to-client streaming.

SSE is:

  • Simpler — built into HTTP, no extra libraries needed
  • Lightweight — fewer overheads compared to WebSockets
  • Browser-native — widely supported without plugins
  • Persistent — automatically reconnects if the connection fails

For use cases where you only need one-way communication, SSE is an elegant solution.

Final Thoughts

The new Server-Sent Events feature in .NET 10 opens the door to easier and more efficient real-time applications.
Whether you’re building financial dashboards, live order systems, or notification services, this feature offers a
lightweight alternative to SignalR and WebSockets.

If you’re curious about diving deeper, Microsoft also introduced .NET Aspire,
a framework for managing distributed applications — and it integrates seamlessly with SSE.

Now the question is:
Will you replace some of your WebSocket or SignalR implementations with SSE in .NET 10?