SignalRChatClient 1.2.2

dotnet add package SignalRChatClient --version 1.2.2                
NuGet\Install-Package SignalRChatClient -Version 1.2.2                
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="SignalRChatClient" Version="1.2.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SignalRChatClient --version 1.2.2                
#r "nuget: SignalRChatClient, 1.2.2"                
#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 SignalRChatClient as a Cake Addin
#addin nuget:?package=SignalRChatClient&version=1.2.2

// Install SignalRChatClient as a Cake Tool
#tool nuget:?package=SignalRChatClient&version=1.2.2                

CP.AspNetCore.SignalR.Client.Rx

Reactive Extensions for Microsoft.AspNetCore.SignalR.Client

Installation

Install-Package CP.AspNetCore.SignalR.Client.Rx

Usage

using CP.AspNetCore.SignalR.Client.Rx;
var connection = new HubConnectionBuilder()
    .WithUrl("http://localhost:5000/hub")
    .AutoReconnect()
    .Build();

var sub = connection.On<string>("Stream").Subscribe(Console.WriteLine);

var con = connection.StartAsync().Subscribe();

Other options

    HubBuilder.Create(builder => builder.WithUrl("https://localhost:53933/ChatHub"))
    .Subscribe(x =>
    {
        var connection = x.hubConnection;
        x.disposables.Add(connection.On<string, string>("ReceiveMessage").Subscribe(responce => Dispatcher.Invoke(() =>
        {
            var newMessage = $"{responce.t1}: {responce.t2}";
            messagesList.Items.Add(newMessage);
        })));

        x.disposables.Add(connection.HasClosed().Subscribe(error => Dispatcher.Invoke(() =>
        {
            connectButton.IsEnabled = true;
            sendButton.IsEnabled = false;
            messagesList.Items.Add(error);
        })));

        x.disposables.Add(connectButton.Events().Click.Start(connection).Subscribe(_ => Dispatcher.Invoke(() =>
        {
            try
            {
                messagesList.Items.Add("Connection started");
                connectButton.IsEnabled = false;
                sendButton.IsEnabled = true;
            }
            catch (Exception ex)
            {
                messagesList.Items.Add(ex.Message);
            }
        })));

        x.disposables.Add(sendButton.Events().Click.Subscribe(_ => Dispatcher.Invoke(async () =>
        {
            try
            {
                await connection.InvokeAsync("SendMessage", userTextBox.Text, messageTextBox.Text);
            }
            catch (Exception ex)
            {
                messagesList.Items.Add(ex.Message);
            }
        })));
    });

Available operators

  • On<T>(string methodName)

  • On<T1, T2>(string methodName)

  • On<T1, T2, T3>(string methodName)

  • On<T1, T2, T3, T4>(string methodName)

  • On<T1, T2, T3, T4, T5>(string methodName)

  • On<T1, T2, T3, T4, T5, T6>(string methodName)

  • On<T1, T2, T3, T4, T5, T6, T7>(string methodName)

  • On<T1, T2, T3, T4, T5, T6, T7, T8>(string methodName)

  • HasClosed()

  • HasReconnected()

  • IsReconnecting()

  • StartObservable()

  • StartObservable(CancellationToken cancellationToken)

  • Start()

  • Start(CancellationToken cancellationToken)

  • Start(HubConnection connection)

  • Start(HubConnection connection, CancellationToken cancellationToken)

  • StopObservable()

  • StreamObservable()

  • InvokeAsync(string methodName, params object[] args)

  • HubBuilder.Create(builder => // Configure Builder)

Product Compatible and additional computed target framework versions.
.NET net9.0-windows7.0 is compatible. 
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
1.2.2 48 11/20/2024
1.1.15 131 9/18/2024
1.1.10 100 8/7/2024
1.1.8 127 6/25/2024

Compatability with Net 6 / 7 and net462