PollySignalR 1.0.2

dotnet add package PollySignalR --version 1.0.2
                    
NuGet\Install-Package PollySignalR -Version 1.0.2
                    
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.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PollySignalR" Version="1.0.2" />
                    
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.2
                    
#r "nuget: PollySignalR, 1.0.2"
                    
#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.2
                    
#: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.2
                    
Install as a Cake Addin
#tool nuget:?package=PollySignalR&version=1.0.2
                    
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
PollyHealthChecks Downloads ASP.NET Core health checks for Polly v8 circuit breakers — expose circuit-breaker state (Closed, HalfOpen, Open, Isolated) as /health endpoint responses
PollyBackoff Downloads Backoff delay strategies for Polly v8 resilience pipelines
PollyGrpc Downloads Polly v8 resilience interceptor for gRPC
PollyEFCore Downloads Polly v8 resilience pipelines for Entity Framework Core — wrap every EF Core query and SaveChanges with retry, timeout and circuit-breaker via a single AddPollyResilience() call
PollyMailKit Downloads Polly v8 resilience pipelines for MailKit — retry, timeout, and circuit-breaker for SmtpClient.SendAsync and any MailKit SMTP operation
PollyMassTransit Downloads Polly v8 resilience pipelines for MassTransit — retry, timeout, and circuit-breaker for IBus.Publish and ISendEndpointProvider.Send
PollyOpenAI Downloads Polly v8 resilience for OpenAI and Azure OpenAI API calls
PollyAzureEventHub Downloads Polly v8 resilience pipelines for Azure Event Hubs — retry, timeout, and circuit-breaker for EventHubProducerClient and EventHubConsumerClient
PollyElasticsearch Downloads Polly v8 resilience pipelines for Elastic.Clients.Elasticsearch 8+ — retry, timeout, and circuit-breaker for any Elasticsearch operation, plus a built-in ElasticTransientErrors predicate covering rate limiting (429), service unavailability (503), gateway timeouts (504), and connection failures
PollyHangfire Downloads Polly v8 resilience pipelines for Hangfire — retry, timeout, and circuit-breaker for IBackgroundJobClient.Enqueue and Schedule
PollySendGrid Downloads Polly v8 resilience pipelines for SendGrid — retry, timeout, and circuit-breaker for ISendGridClient.SendEmailAsync
PollyMediatR Downloads Polly v8 resilience pipelines for MediatR — add retry, timeout, circuit-breaker, rate-limiting, hedging, and chaos engineering to any MediatR request handler with a single line of DI registration
PollyAzureKeyVault Downloads Polly v8 resilience pipelines for Azure Key Vault — retry, timeout, and circuit-breaker for SecretClient, KeyClient, and CertificateClient
PollyAzureQueueStorage Downloads Polly v8 resilience pipelines for Azure Queue Storage — retry, timeout, and circuit-breaker for Azure.Storage.Queues QueueClient
PollyRedis Downloads Polly v8 resilience for StackExchange.Redis
PollyAzureServiceBus Downloads Polly v8 resilience for Azure Service Bus — retry, circuit breaker, and timeout for sending and receiving messages
PollyKafka Downloads Polly v8 resilience for Confluent.Kafka — retry, circuit breaker, and timeout for producers and consumers
PollyAzureTableStorage Downloads Polly v8 resilience pipelines for Azure Table Storage — retry, timeout, and circuit-breaker for Azure.Data.Tables TableClient
PollyChaos Downloads Chaos engineering and fault-injection resilience strategies for Polly v8 pipelines

💼 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 is compatible.  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.2 212 8/7/2026
1.0.1 121 7/7/2026
1.0.0 127 6/23/2026

1.0.2: Add net10.0 target framework support. 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.