WebSockets.Resilience
1.0.0
dotnet add package WebSockets.Resilience --version 1.0.0
NuGet\Install-Package WebSockets.Resilience -Version 1.0.0
<PackageReference Include="WebSockets.Resilience" Version="1.0.0" />
<PackageVersion Include="WebSockets.Resilience" Version="1.0.0" />
<PackageReference Include="WebSockets.Resilience" />
paket add WebSockets.Resilience --version 1.0.0
#r "nuget: WebSockets.Resilience, 1.0.0"
#:package WebSockets.Resilience@1.0.0
#addin nuget:?package=WebSockets.Resilience&version=1.0.0
#tool nuget:?package=WebSockets.Resilience&version=1.0.0
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:
SendAsyncnever 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.
DisposeAsyncstays fast and abrupt, and can lose whatever's still queued;CloseAsyncinstead 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 | Versions 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. |
-
.NETFramework 4.6.2
- System.Threading.Channels (>= 9.0.4)
- WebSockets (>= 1.0.0)
-
net5.0
- WebSockets (>= 1.0.0)
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 |