Search⌘ K
AI Features

Server Streaming in SignalR

Explore how to implement server streaming in SignalR by adding streaming methods to ASP.NET Core hubs and configuring JavaScript and .NET clients to handle streamed messages efficiently. Understand cancellation handling and message iteration for real-time data flow.

Introduction

As the name suggests, server streaming works the other way. However, you still need a client involved. The client needs to trigger a server streaming endpoint on the server. Once it’s triggered, it will subscribe to the stream and read messages from it either until no more messages are left or the server disconnects the stream.

Server streaming
Server streaming

We will now add some server streaming functionality to our clients and the server-side hub. This time, we'll start with the server because it controls the stream.

Adding server streaming

...