System.Net.WebSockets.WebSocketProtocol 5.1.0

About

Provides the WebSocketProtocol class, which allows creating a WebSocket from a connected stream using WebSocketsProtocol.CreateFromConnectedStream.

NOTE: This package was designed as a temporary solution for internal use (building ASP.NET targeting .NET Standard 2.0), and is now considered obsolete. If targeting .NET Standard 2.1 or .NET 5+, use WebSocket.CreateFromStream instead.

Key Features

  • Creates a new WebSocket instance that operates on the specified transport stream. The WebSocket class allows applications to send and receive data after the WebSocket upgrade has completed.
  • The API can be used to create both client-side and server-side WebSocket instances.

How to Use

To create a WebSocket using WebSocketProtocol, as a prerequisite, you need to prepare the opaque transport stream for the WebSocket, for example, create or accept a TCP socket connection as a Stream and perform a WebSocket opening handshake (upgrade) over it. Then you can use the transport stream and the negotiated subprotocol to call WebSocketProtocol.CreateFromStream.

Stream opaqueTransport = /* ... */; // complete WebSocket opening handshake over the transport connection
WebSocket ws = WebSocketProtocol.CreateFromStream(opaqueTransport, isServer: true, subProtocol, keepAliveInterval);

Remarks

The API is considered obsolete and is not recommented for use.

On .NET Framework or .NET Standard 2.0:

On .NET Core 2.1+, .NET 5+ or .NET Standard 2.1:

Main Types

The main types provided by this library are:

  • System.Net.WebSockets.WebSocketProtocol

Additional Documentation

License

System.Net.WebSockets.WebSocketProtocol is released as open source under the MIT license.

No packages depend on System.Net.WebSockets.WebSocketProtocol.

Version Downloads Last updated
6.0.0-preview.1.21102.12 13 03/06/2025
5.1.0 13 03/12/2025
5.0.0 14 03/12/2025
5.0.0-rc.2.20475.5 13 03/06/2025
5.0.0-rc.1.20451.14 12 03/06/2025
5.0.0-preview.7.20364.11 12 03/06/2025
5.0.0-preview.6.20305.6 12 03/06/2025
5.0.0-preview.5.20278.1 13 03/06/2025
5.0.0-preview.4.20251.6 13 03/06/2025
5.0.0-preview.3.20214.6 14 03/12/2025
5.0.0-preview.2.20160.6 13 03/06/2025
5.0.0-preview.1.20120.5 15 03/12/2025
4.7.1 13 03/06/2025
4.7.0 12 03/06/2025
4.7.0-preview3.19551.4 14 03/12/2025
4.7.0-preview1.19504.10 10 03/06/2025
4.6.0-rc1.19456.4 15 03/12/2025
4.6.0-preview9.19421.4 14 03/12/2025
4.6.0-preview9.19416.11 11 03/06/2025
4.6.0-preview8.19405.3 13 03/12/2025
4.6.0-preview7.19362.9 14 03/06/2025
4.6.0-preview6.19303.8 11 03/06/2025
4.6.0-preview6.19264.9 13 03/06/2025
4.6.0-preview5.19224.8 14 03/06/2025
4.6.0-preview4.19212.13 11 03/06/2025
4.6.0-preview3.19128.7 14 03/06/2025
4.6.0-preview.19073.11 14 03/12/2025
4.6.0-preview.18571.3 13 03/06/2025
4.5.3 14 03/12/2025
4.5.2 14 03/06/2025
4.5.1 15 01/14/2024
4.5.0-rc1 13 03/06/2025
4.5.0-preview2-26406-04 11 03/06/2025