WebSockets 1.0.0

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

WebSockets

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

Is WebSockets still maintained?

It can be easy to assume that no activity on a repository and/or no updates in a long time means that a project has been abandoned. That is absolutely not the case here!

The reality is that this package is designed to fix an issue that isn't going to change, so we might go long stretches between updates, if there's ever another one needed at all. That's driven by a few things:

  • .NET Framework 4.6.2, while still supported by Microsoft as part of Windows, is a stable, feature-frozen target that Microsoft's ongoing .NET investment has moved past.
  • .NET 5.0 is out of official support - but we chose that target so that we could provide support for all future .NET versions.
  • Microsoft treats this as intended behavior rather than a defect to patch, so there's no reason to expect it to disappear on its own in some future .NET release.
  • Given that nothing here is expected to change, there's nothing that would obviously require this package to change either.

You can rest assured that this package will continue to be maintained if any issues are ever reported or new features requested.

Overview

WebSocketClient is a System.Net.WebSockets.ClientWebSocket replacement that performs the same handshake and reuses the same underlying native WebSocket implementation for framing, but treats Upgrade, Connection, and Sec-WebSocket-Accept header validation as overridable delegates with sensible, RFC 6455-compliant defaults, rather than hardcoding them internally the way ClientWebSocket does.

The default Connection check is the fix this package exists for. ClientWebSocket validates the handshake response more strictly than the spec requires: its Connection header check demands an exact match against "Upgrade", so a spec-legal response like Connection: Upgrade, Keep-Alive fails with:

System.Net.WebSockets.WebSocketException: The 'Connection' header value 'Upgrade, Keep-Alive' is invalid.

This affects both .NET Framework and modern .NET. The check is hardcoded on both platforms, with no option to relax it and no way to work around it from calling code. WebSocketClient's default Connection check instead treats the header as a comma-separated token list and accepts it as long as Upgrade is one of the tokens, rather than requiring an exact match against the whole value. A server responding with Connection: Upgrade, Keep-Alive connects successfully by default, no configuration required.

Need reconnection, backoff, or a send queue that survives a dropped connection? Check out WebSockets.Resilience.

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.
  • .NETFramework 4.6.2

    • No dependencies.
  • net5.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on WebSockets:

Package Downloads
WebSockets.Resilience

A resilient WebSocket wrapper.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 92 7/20/2026