Sign in to track progress and bookmarks.
Sometimes you don't want to wait for a whole calculation to finish before showing results. Streaming allows the server to send data as it becomes available.
In modern .NET Hubs, you can return an IAsyncEnumerable<T>. SignalR will automatically stream each item to the client as it is yielded. This is perfect for high-frequency logs, progress reports, or searching across a massive dataset where you want to show 'live' results.
For more complex scenarios, you can use System.Threading.Channels. Your Hub creates a channel and returns the Reader to the client. Background threads can then 'Write' into the channel, and the client will receive them in the exact order they were written. This is the 'Industrial' way to handle streaming in .NET.
Q: "When should I use streaming instead of standard Hub methods?"
Architect Answer: "Use streaming when the total payload is large or the generation time is long. Large payloads in a single SendAsync can block the Hub for other users. Streaming breaks that payload into small, manageable 'Frames', keeping the connection healthy and the UI responsive."
Quizzes linked to this course—pass to earn certificates.
On this page
1. AsyncEnumerable Streaming 2. The Channel Pattern 3. Architect Insight