A high-performance NATS backplane for ASP.NET Core SignalR, enabling horizontal scaling of SignalR hubs across multiple server instances.
Install the package from NuGet:
dotnet add package Stebet.SignalR.NATSCall AddNats on your SignalR builder in Program.cs:
builder.Services.AddSignalR()
.AddNats("nats://localhost:4222");AddNats accepts an optional subject prefix (default: "signalr.nats") used for all NATS subjects. Override it if you run multiple SignalR applications sharing the same NATS cluster:
builder.Services.AddSignalR()
.AddNats("nats://localhost:4222", natsSubjectPrefix: "myapp.signalr");Pass a comma-separated list of server URLs to connect to a NATS cluster:
builder.Services.AddSignalR()
.AddNats("nats://nats1:4222,nats://nats2:4222,nats://nats3:4222");- .NET 9.0 or later
- A running NATS Server (2.x or later)
See DEVELOPMENT.md for instructions on how to build the solution, run tests, and run load tests.