RxSignalrStreams.Extensions 1.0.1

.NET Standard 2.0
dotnet add package RxSignalrStreams.Extensions --version 1.0.1
NuGet\Install-Package RxSignalrStreams.Extensions -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RxSignalrStreams.Extensions" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RxSignalrStreams.Extensions --version 1.0.1
#r "nuget: RxSignalrStreams.Extensions, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install RxSignalrStreams.Extensions as a Cake Addin
#addin nuget:?package=RxSignalrStreams.Extensions&version=1.0.1

// Install RxSignalrStreams.Extensions as a Cake Tool
#tool nuget:?package=RxSignalrStreams.Extensions&version=1.0.1

Extensions for Reactive SignalR streaming

Since ASP.NET Core 2.1, we can now use SignalR streaming to push data to or receive data from client/server.

By design, only ChannelReader<T> class is supported to create a stream from the server to the client. For your information, since ASP.NET Core 3.0, the IAsyncEnumerable<T> is also supported.

If you desire to consume an IObservable<T> from the server, you must know that you can be exposed to errors due to backpressure, the fact that the consumer can be slower than the producer which can lead to an inconsistent system. To prevent this error, there is a way to change the streaming behavior by creating a ChannelReader<T> from an IObservable<T>. There are currently 2 possible scenario you can encounter: ignore or buffer.

ToNewestValueStream

The ToNewestValueStream method is made for the ignore all previous values scenario. So, you will always send/receive the latest value as soon as possible even when the consumer is slower than the producer. Previous data can be skipped in favor of the latest one.

Use this scenario when you are in a I don't care about not so fresh data scenario.

public ChannelReader<int> RealtimeWeather()
{
    return _realtimeValuesService.Observe()
        .ToNewestValueStream(Context.ConnectionAborted);
}

ToBufferedStream

The ToBufferedStream method is made for the buffer all previous values scenario. So, you will always send/receive the values from the producer, even when the consumer is slower than the producer. No data will be skipped but it can take a while before having the latest data.

Be aware that it will create a buffer of all the entire data not delivered, which can drastically increase the memory footprint.

Use this scenario when you are in a I care about every single data that was sent scenario.

public ChannelReader<int> RealtimeWeather()
{
    return _realtimeValuesService.Observe()
        .ToBufferedStream(Context.ConnectionAborted);
}
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 154 3/15/2023
1.0.0 19,369 12/7/2019