From 4c59d682065fe8f3fcbb7ab54d6badf7f4192f9b Mon Sep 17 00:00:00 2001 From: Brennan Date: Fri, 13 Sep 2019 19:09:20 -0700 Subject: [PATCH] Use IAsyncEnumerable (#7) --- Hubs/StreamHub.cs | 2 +- StreamManager.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Hubs/StreamHub.cs b/Hubs/StreamHub.cs index 5a28374..8f5f2b2 100644 --- a/Hubs/StreamHub.cs +++ b/Hubs/StreamHub.cs @@ -26,7 +26,7 @@ namespace StreamR return _streamManager.Subscribe(streamName, cancellationToken); } - public async Task StartStream(string streamName, ChannelReader streamContent) + public async Task StartStream(string streamName, IAsyncEnumerable streamContent) { try { diff --git a/StreamManager.cs b/StreamManager.cs index cd02014..1f5f8eb 100644 --- a/StreamManager.cs +++ b/StreamManager.cs @@ -22,7 +22,7 @@ namespace StreamR return streamList; } - public async Task RunStreamAsync(string streamName, ChannelReader stream) + public async Task RunStreamAsync(string streamName, IAsyncEnumerable stream) { var streamHolder = new StreamHolder() { Source = stream }; @@ -34,7 +34,7 @@ namespace StreamR try { - await foreach (var item in stream.ReadAllAsync()) + await foreach (var item in stream) { foreach (var viewer in streamHolder.Viewers) { @@ -88,7 +88,7 @@ namespace StreamR private class StreamHolder { - public ChannelReader Source; + public IAsyncEnumerable Source; public ConcurrentDictionary> Viewers = new ConcurrentDictionary>(); } }