Skip to content

Latest commit

 

History

History
50 lines (32 loc) · 1.53 KB

File metadata and controls

50 lines (32 loc) · 1.53 KB

NuGet codecov

Stebet.SignalR.NATS

A high-performance NATS backplane for ASP.NET Core SignalR, enabling horizontal scaling of SignalR hubs across multiple server instances.

Installation

Install the package from NuGet:

dotnet add package Stebet.SignalR.NATS

Usage

Call AddNats on your SignalR builder in Program.cs:

builder.Services.AddSignalR()
    .AddNats("nats://localhost:4222");

Options

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");

Connecting to a NATS cluster

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");

Requirements

  • .NET 9.0 or later
  • A running NATS Server (2.x or later)

Contributing / Development

See DEVELOPMENT.md for instructions on how to build the solution, run tests, and run load tests.