PollySignalR 1.0.1

dotnet add package PollySignalR --version 1.0.1
                    
NuGet\Install-Package PollySignalR -Version 1.0.1
                    
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="PollySignalR" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PollySignalR" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="PollySignalR" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PollySignalR --version 1.0.1
                    
#r "nuget: PollySignalR, 1.0.1"
                    
#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.
#:package PollySignalR@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PollySignalR&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=PollySignalR&version=1.0.1
                    
Install as a Cake Tool

PollySignalR

NuGet Downloads CI License: MIT

Polly v8 reconnect policy for ASP.NET Core SignalR.
Drop-in replacement for WithAutomaticReconnect(TimeSpan[]) with full Polly v8 exponential back-off, jitter, configurable max retries, and max delay. Also provides StartWithResilienceAsync for resilient initial connections.


Why PollySignalR?

SignalR's built-in reconnect is limited to a fixed array of delays:

Feature WithAutomaticReconnect(TimeSpan[]) PollySignalR
Exponential back-off ❌ manual ✅ automatic
Jitter (reconnect storm prevention)
Configurable max retries ❌ array length
Max delay cap ❌ last array element
Linear back-off option
Infinite retries
Polly v8 pipeline for initial connect
Single line of config

Installation

dotnet add package PollySignalR

Quick Start

var connection = new HubConnectionBuilder()
    .WithUrl("https://example.com/hub")
    .WithPollyReconnect()   // exponential back-off, infinite retries, up to 60 s
    .Build();

Configuration

var connection = new HubConnectionBuilder()
    .WithUrl("https://example.com/hub")
    .WithPollyReconnect(options =>
    {
        options.MaxRetries   = 10;                          // null = infinite (default)
        options.BaseDelay    = TimeSpan.FromSeconds(1);     // default: 1 s
        options.MaxDelay     = TimeSpan.FromSeconds(60);    // default: 60 s
        options.JitterFactor = 0.5;                         // ±50% noise (default)
        options.BackoffType  = DelayBackoffType.Exponential; // or Linear
    })
    .Build();

How delays are computed

delay = clamp(BaseDelay × 2^attempt, 0, MaxDelay)
      + random(−JitterFactor × BaseDelay, +JitterFactor × BaseDelay)
Attempt BaseDelay=1s, MaxDelay=60s
0 ~1 s
1 ~2 s
2 ~4 s
3 ~8 s
4 ~16 s
5 ~32 s
6+ ~60 s (capped)

Resilient initial connection

Use StartWithResilienceAsync to apply a full Polly v8 pipeline to the first connect attempt (before automatic reconnect takes over):

var pipeline = new ResiliencePipelineBuilder()
    .AddRetry(new RetryStrategyOptions
    {
        ShouldHandle  = new PredicateBuilder().Handle<Exception>(),
        MaxRetryAttempts = 5,
        BackoffType   = DelayBackoffType.Exponential,
        Delay         = TimeSpan.FromSeconds(1),
        UseJitter     = true,
    })
    .AddTimeout(new TimeoutStrategyOptions { Timeout = TimeSpan.FromSeconds(30) })
    .Build();

await connection.StartWithResilienceAsync(pipeline);

Blazor WebAssembly

// Program.cs
builder.Services.AddSingleton(sp =>
    new HubConnectionBuilder()
        .WithUrl(builder.HostEnvironment.BaseAddress + "chathub")
        .WithPollyReconnect(o =>
        {
            o.BaseDelay  = TimeSpan.FromSeconds(2);
            o.MaxDelay   = TimeSpan.FromSeconds(120);
            o.MaxRetries = null; // never give up
        })
        .Build());

Package Downloads Description
PollyOpenAI Downloads Polly v8 resilience for OpenAI and Azure OpenAI API calls
PollyRedis Downloads Polly v8 resilience for StackExchange.Redis
PollyEFCore Downloads Polly v8 resilience for EF Core queries and SaveChanges
PollyHealthChecks Downloads ASP.NET Core health checks for Polly v8 circuit breakers
PollyChaos Downloads Chaos engineering / fault injection for Polly v8
PollyMediatR Downloads Polly v8 pipelines for MediatR request handlers
PollyElasticsearch Polly v8 for Elastic.Clients.Elasticsearch
PollyAzureKeyVault Polly v8 for Azure Key Vault
PollySendGrid Polly v8 for SendGrid
PollyMassTransit Polly v8 for MassTransit
PollyAzureTableStorage Polly v8 for Azure Table Storage
PollyMailKit MailKit SMTP email client
PollyAzureQueueStorage Azure Queue Storage QueueClient
PollyHangfire Hangfire IBackgroundJobClient
PollyBackoff Downloads Custom back-off strategies for Polly v8

| PollyGrpc | Polly v8 resilience (retry, CB, timeout) for gRPC .NET clients via Interceptor | | PollyKafka | Polly v8 resilience (retry, CB, timeout) for Confluent.Kafka producers and consumers | | PollyAzureEventHub | Polly v8 for Azure Event Hubs | | PollyAzureServiceBus | Polly v8 resilience (retry, CB, timeout) for Azure Service Bus senders and receivers |

💼 Need .NET consulting?

The author of this package is available for consulting on Polly v8 resilience, Azure cloud architecture, and clean .NET design.

→ solidqualitysolutions.com · LinkedIn

License

MIT

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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
1.0.1 94 7/7/2026
1.0.0 115 6/23/2026

1.0.1: Fix package icon (was showing an incorrect/placeholder image). Initial release. Polly v8 exponential back-off reconnect policy for SignalR HubConnection, plus StartWithResilienceAsync for resilient initial connections.