From 2aa982e164122de01bbeafe4df16e525770f6e07 Mon Sep 17 00:00:00 2001 From: Nick Kotov Date: Fri, 22 Jun 2018 18:08:23 +0300 Subject: [PATCH] SignalR stream sample fix. Link to sample updated in related article. (#7237) - Fixed sample for SignalR stream usage. - Link to this code sample updated as well, because of 404 error when opening it from aspnetcore/signalr/streaming.md --- aspnetcore/signalr/streaming.md | 4 ++-- aspnetcore/signalr/streaming/sample/Hubs/StreamHub.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aspnetcore/signalr/streaming.md b/aspnetcore/signalr/streaming.md index 3df117015e..65a65aa4dd 100644 --- a/aspnetcore/signalr/streaming.md +++ b/aspnetcore/signalr/streaming.md @@ -24,7 +24,7 @@ A hub method automatically becomes a streaming hub method when it returns a `Cha > [!NOTE] > Write to the `ChannelReader` on a background thread and return the `ChannelReader` as soon as possible. Other hub invocations will be blocked until a `ChannelReader` is returned. -[!code-csharp[Streaming hub method](streaming/sample/hubs/streamhub.cs?range=10-34)] +[!code-csharp[Streaming hub method](streaming/sample/Hubs/StreamHub.cs?range=10-34)] ## .NET client @@ -64,4 +64,4 @@ To end the stream from the client call the `dispose` method on the `ISubscriptio * [Hubs](xref:signalr/hubs) * [.NET client](xref:signalr/dotnet-client) * [JavaScript client](xref:signalr/javascript-client) -* [Publish to Azure](xref:signalr/publish-to-azure-web-app) \ No newline at end of file +* [Publish to Azure](xref:signalr/publish-to-azure-web-app) diff --git a/aspnetcore/signalr/streaming/sample/Hubs/StreamHub.cs b/aspnetcore/signalr/streaming/sample/Hubs/StreamHub.cs index 7c4c4c4068..d20a82e2e9 100644 --- a/aspnetcore/signalr/streaming/sample/Hubs/StreamHub.cs +++ b/aspnetcore/signalr/streaming/sample/Hubs/StreamHub.cs @@ -25,11 +25,11 @@ namespace SignalRChat.Hubs { for (var i = 0; i < count; i++) { - await channel.Writer.WriteAsync(i); + await writer.WriteAsync(i); await Task.Delay(delay); } - channel.Writer.TryComplete(); + writer.TryComplete(); } } }