Talrace.Core.SignalR
6.0.2
See the version list below for details.
dotnet add package Talrace.Core.SignalR --version 6.0.2
NuGet\Install-Package Talrace.Core.SignalR -Version 6.0.2
<PackageReference Include="Talrace.Core.SignalR" Version="6.0.2" />
paket add Talrace.Core.SignalR --version 6.0.2
#r "nuget: Talrace.Core.SignalR, 6.0.2"
// Install Talrace.Core.SignalR as a Cake Addin
#addin nuget:?package=Talrace.Core.SignalR&version=6.0.2
// Install Talrace.Core.SignalR as a Cake Tool
#tool nuget:?package=Talrace.Core.SignalR&version=6.0.2
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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 was computed. 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. |
-
net6.0
- Microsoft.AspNetCore.SignalR.StackExchangeRedis (>= 6.0.4)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 6.0.0)
- Newtonsoft.Json (>= 13.0.1)
- Talrace.Core.Extensions (>= 6.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.