WebSockets.Resilience 1.0.0

dotnet add package WebSockets.Resilience --version 1.0.0
                    
NuGet\Install-Package WebSockets.Resilience -Version 1.0.0
                    
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="WebSockets.Resilience" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WebSockets.Resilience" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="WebSockets.Resilience" />
                    
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 WebSockets.Resilience --version 1.0.0
                    
#r "nuget: WebSockets.Resilience, 1.0.0"
                    
#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 WebSockets.Resilience@1.0.0
                    
#: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=WebSockets.Resilience&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=WebSockets.Resilience&version=1.0.0
                    
Install as a Cake Tool

WebSockets.Resilience

Targets net462 and net5.0. Full documentation is at https://scottoffen.github.io/websockets.

Overview

ResilientWebSocketClient layers reconnection, a configurable backoff strategy, a send queue that survives reconnect gaps, and fragmented-message reassembly on top of IWebSocketClient

A live WebSocket (from ClientWebSocket or WebSockets' own WebSocketClient) is a single, one-shot connection by design, it can't reconnect itself. ResilientWebSocketClient can't just hand one back the way WebSocketClient.ConnectAsync does; it owns the reconnect loop itself and gives the caller a stable send/receive surface across however many underlying connections happen along the way.

Using this package guarantees

Using this package means:

  • A dropped connection is detected and reconnected automatically, with the backoff strategy you choose.
  • A message sent while genuinely disconnected is queued and delivered once reconnected. This is a real guarantee: SendAsync never throws just because there's no live connection at the moment.
  • A message that fails to send is requeued rather than silently dropped, so a connection dying mid-send doesn't lose it.
  • Shutting down doesn't have to lose queued messages. DisposeAsync stays fast and abrupt, and can lose whatever's still queued; CloseAsync instead gives everything already queued a bounded chance to actually go out first.

What can't be guaranteed

A message sent in the exact instant a connection is dying, before either side has noticed yet. TCP doesn't guarantee a local send fails just because the remote end already reset the connection; a write can appear to succeed at the socket-buffer level into a connection that's already dead, with no exception raised.

Closing that gap completely needs an application-level acknowledgment protocol (the server confirms receipt, the client only clears its own queue on that confirmation), which requires server-side cooperation and is out of scope for a general-purpose client.

ResilientWebSocketClient requeues on a failed send, which narrows, but does not eliminate, the gap above.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  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.  net9.0 was computed.  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. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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.0 92 7/20/2026
1.0.0-preview-0001 81 7/20/2026