Загрузка...

Goodbye SignalR? Native Server-Sent Events are Here!

Get the source code for this video for FREE → https://the-dotnet-weekly.ck.page/sse
Want to master Clean Architecture? Go here: https://bit.ly/3PupkOJ
Want to unlock Modular Monoliths? Go here: https://bit.ly/3SXlzSt

Starting with .NET 10, we have a new native option for server-to-client communication: Server-Sent Events (SSE). While SignalR has been the default for real-time updates, it can be heavy for simple "server push" scenarios. In this video, I’ll show you how to implement a lightweight, native SSE endpoint in ASP.NET Core.

What We’ll Cover:
- SignalR vs. SSE: Why SSE is a powerful, unidirectional alternative when you only need to send data from the server to the client.
- Minimal API Integration: How to use the new Results.ServerSentEvents result type.
- Streaming with .NET Channels: Integrating ChannelReader to stream background data to your clients in real-time.
- Reconnection Support: Implementing a robust system to replay missed messages using the Last-Event-ID header and an event buffer.
- The Client Side: How to use the native JavaScript EventSource API to consume your stream in the browser.

Why Server-Sent Events?
SignalR abstracts complex flows and supports WebSockets and two-way communication. However, SSE is incredibly lightweight and runs over a single, persistent HTTP connection. If your application only requires the server to push updates—like order tracking or live notifications—SSE is a prime example of a "server push" architecture that is easier to manage.

Adding Real-Time Functionality To .NET Applications With SignalR
https://www.milanjovanovic.tech/blog/adding-real-time-functionality-to-dotnet-applications-with-signalr

Building Async APIs in ASP.NET Core - The Right Way
https://www.milanjovanovic.tech/blog/building-async-apis-in-aspnetcore-the-right-way

Check out my courses:
https://www.milanjovanovic.tech/courses

Read my Blog here:
https://www.milanjovanovic.tech/blog

Join my weekly .NET newsletter:
https://www.milanjovanovic.tech

Chapters

Видео Goodbye SignalR? Native Server-Sent Events are Here! канала Milan Jovanović
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять