Nethereum.Parity.Reactive 7.1.0

Prefix Reserved
dotnet add package Nethereum.Parity.Reactive --version 7.1.0
                    
NuGet\Install-Package Nethereum.Parity.Reactive -Version 7.1.0
                    
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="Nethereum.Parity.Reactive" Version="7.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nethereum.Parity.Reactive" Version="7.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Nethereum.Parity.Reactive" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Nethereum.Parity.Reactive --version 7.1.0
                    
#r "nuget: Nethereum.Parity.Reactive, 7.1.0"
                    
#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.
#:package Nethereum.Parity.Reactive@7.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Nethereum.Parity.Reactive&version=7.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Nethereum.Parity.Reactive&version=7.1.0
                    
Install as a Cake Tool

Nethereum.Parity.Reactive

Reactive (IObservable) subscriptions over Parity's parity_subscribe pub/sub

NuGet

Overview

Nethereum.Parity.Reactive contains one class, ParityPubSubObservableSubscription<TResponse>. It takes any RpcRequest, re-sends it wrapped in a parity_subscribe request over a streaming client, and surfaces the subscription's responses as Rx observables. Use it when you are connected to a Parity / OpenEthereum node through a streaming transport (for example a WebSocket client implementing IStreamingClient) and want IObservable results for parity_subscribe. For the non-reactive parity_* and trace_* calls use Nethereum.Parity; the other Rx streams live in Nethereum.RPC.Reactive, whose RpcStreamingSubscriptionObservableHandler<T> this class derives from.

Installation

dotnet add package Nethereum.Parity.Reactive

Project references: Nethereum.Parity and Nethereum.RPC.Reactive; package reference System.Reactive 4.1.3. Target frameworks come from the build's ReactiveFrameworks property (net461, netstandard2.0, net6.0, net8.0, net9.0, net10.0 in the default build).

ParityPubSubObservableSubscription

Namespace Nethereum.Parity.Reactive.

public class ParityPubSubObservableSubscription<TResponse> : RpcStreamingSubscriptionObservableHandler<TResponse>
{
    public ParityPubSubObservableSubscription(IStreamingClient client)

    public Task SubscribeAsync(RpcRequest originalRequestToSubscribe, object id = null)
    public RpcRequest BuildRequest(RpcRequest originalRequestToSubscribe, object id = null)
}
  • The constructor passes an EthUnsubscribeRequestBuilder to the base class, so unsubscribing sends the standard unsubscribe request, not parity_unsubscribe.
  • BuildRequest delegates to ParitySubscribeRequestBuilder from Nethereum.Parity: the result is a parity_subscribe request whose parameters are the original method name followed by the original parameters. A null id becomes a new GUID string.
  • SubscribeAsync builds that request and subscribes with it.

Inherited from RpcStreamingSubscriptionObservableHandler<TResponse> and RpcStreamingSubscriptionHandler<TResponse>:

public IObservable<string> GetSubscribeResponseAsObservable()
public IObservable<TResponse> GetSubscriptionDataResponsesAsObservable()
public IObservable<bool> GetUnsubscribeResponseAsObservable()
public Task UnsubscribeAsync()
public string SubscriptionId { get; protected set; }
public SubscriptionState SubscriptionState { get; protected set; }

Subscribing and observing the results:

var subscription = new ParityPubSubObservableSubscription<JToken>(streamingClient);

subscription.GetSubscribeResponseAsObservable().Subscribe(subscriptionIds.Add);
subscription.GetSubscriptionDataResponsesAsObservable().Subscribe(result => received.Add(result));

var balanceRequest = new RpcRequest(1, "eth_getBalance", Address, "latest");
await subscription.SubscribeAsync(balanceRequest, "sub-1");

The streaming client receives one parity_subscribe request whose first parameter is "eth_getBalance"; when the node answers with the subscription id, SubscriptionId is set and the subscribe observable emits it; each later notification for that id is emitted by the data observable. Unsubscribing sends the standard eth_unsubscribe request:

await subscription.UnsubscribeAsync();

Backed by ParityPubSubObservableSubscriptionTests.ShouldSubscribeThroughParitySubscribeAndObserveTheResults and ShouldUnsubscribeWithTheStandardUnsubscribeRequest (DocSection.ClientExtensions, parity-reactive) in tests/Nethereum.Parity.IntegrationTests. They use a fake IStreamingClient that answers the subscribe request with the id 0xsub1 and then pushes parity_subscription notifications, so no node is needed; streamingClient in a real application is a connected WebSocket (or other) IStreamingClient.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
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
7.1.0 95 11/10/2026
7.0.0 237 10/2/2026
6.1.0 1,710 3/25/2026
6.0.4 239 3/18/2026
6.0.3 163 3/18/2026
6.0.1 187 3/17/2026
6.0.0 173 3/16/2026
5.8.0 1,395 1/6/2026
5.0.0 17,091 5/28/2025
4.29.0 463 2/10/2025
4.28.0 565 1/7/2025
4.27.1 347 12/24/2024
4.27.0 291 12/24/2024
4.26.0 753 10/1/2024
4.25.0 485 9/19/2024
4.21.4 20,900 8/9/2024
4.21.3 336 7/22/2024
4.21.2 505 6/26/2024
4.21.1 895 6/26/2024
4.21.0 341 6/18/2024
Loading failed