Talrace.Core.SignalR 8.0.0

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

// Install Talrace.Core.SignalR as a Cake Tool
#tool nuget:?package=Talrace.Core.SignalR&version=8.0.0

About

This package for build real-time web applications using SignalR framework in .NET Core.
It provides sets of abstractions and implementations for working with SignalR in .NET Core:

  • user/connection tracking for single application instance (using In-memory user store).
  • user/connection tracking for multi application instance (using Redis user store).

Available api

SignalRServiceCollectionExtensions - static class provides extension methods for the IServiceCollection interface.
IUserTracker<out THub> - interface provides methods for managing user connections.
HubWithUserTracking - class provides connection, group, and messaging management. Define a user connection tracker.

SignalR configuration

Add SignalR with in the memory user connection tracking in dependency container.

public void ConfigureServices(IServiceCollection services) {
    services.AddInMemorySignalR();
}

Create a hub class inherited from HubWithUserTracking class and override GetUserTracker() method.

public class TestHub : HubWithUserTracking {
    public TestHub(IServiceProvider serviceProvider) : base(serviceProvider) { }

    protected override IUserTracker<HubWithUserTracking> GetUserTracker() {
        return ServiceProvider.GetRequiredService<IUserTracker<TestHub>>();
    }
}

Use MapHub<TestHub> to match the route for the Hub in the application.

public void Configure(IApplicationBuilder app) {
    app.UseEndpoints(endpoints => {
        endpoints.MapHub<TestHub>("/testhub");
    });
}

SignalR with redis server configuration

Add section about redis settings to appsettings.json.

{
  "RedisSettings": {
    "DefaultDatabase": <DatabaseIndex>,
    "EndPoints": [ "<ServerEndPoint>" ],
    "Password": "<ServerPassword>",
    "ChannelPrefix": "<ChannelPrefix>"
  }
}

Add SignalR with Redis user connection tracking in dependency container.

public void ConfigureServices(IServiceCollection services) {
    var section = Configuration.GetSection("RedisSettings");
    services.AddRedisSignalR(section);
}

Create a hub class inherited from HubWithUserTracking class and override GetUserTracker() method.

public class TestHub : HubWithUserTracking {
    public TestHub(IServiceProvider serviceProvider) : base(serviceProvider) { }

    protected override IUserTracker<HubWithUserTracking> GetUserTracker() {
        return ServiceProvider.GetRequiredService<IUserTracker<TestHub>>();
    }
}

Use MapHub<TestHub> to match the route for the Hub in the application.

public void Configure(IApplicationBuilder app) {
    app.UseEndpoints(endpoints => {
        endpoints.MapHub<TestHub>("/testhub");
    });
}
Product Compatible and additional computed target framework versions.
.NET 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. 
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
8.0.0 418 11/30/2023
6.0.3 193 3/28/2023
6.0.2 2,058 2/22/2023
6.0.1 674 5/5/2022
6.0.0 375 4/27/2022
3.1.19 291 9/24/2021
3.1.10 3,741 1/26/2021
3.1.1 2,681 4/14/2020
3.1.0 432 4/13/2020