AspNetWebSocket Class

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Represents a real-time full-duplex connection between a web server and a client in an ASP.NET application.

Namespace:   System.Web.WebSockets
Assembly:  System.Web (in System.Web.dll)


public sealed class AspNetWebSocket : WebSocket


Gets a status code that indicates why an AspNetWebSocket object was closed.(Overrides WebSocket.CloseStatus.)


Gets a status message that explains why an AspNetWebSocket object was closed.(Overrides WebSocket.CloseStatusDescription.)


Gets a value that indicates the open or closed state of an AspNetWebSocket object.(Overrides WebSocket.State.)


Gets the name of an application-specific protocol that a remote client and a server can use to exchange data over an AspNetWebSocket connection.(Overrides WebSocket.SubProtocol.)


Cancels any pending I/O operations on the AspNetWebSocket object and sets the state of the object so that it cannot be used to start additional I/O operations.(Overrides WebSocket.Abort().)

System_CAPS_pubmethodCloseAsync(WebSocketCloseStatus, String, CancellationToken)

Sends an asynchronous message to a client to close the connection. If the server initiates the request to close the connection, the method waits for the client to acknowledge the request before it returns.(Overrides WebSocket.CloseAsync(WebSocketCloseStatus, String, CancellationToken).)

System_CAPS_pubmethodCloseOutputAsync(WebSocketCloseStatus, String, CancellationToken)

Sends an asynchronous message to a client to close the connection. If the server initiates the request to close the connection, the method returns without waiting for a response.(Overrides WebSocket.CloseOutputAsync(WebSocketCloseStatus, String, CancellationToken).)


Releases all resources used by an AspNetWebSocket object.(Overrides WebSocket.Dispose().)


Determines whether the specified object is equal to the current object.(Inherited from Object.)


Serves as the default hash function. (Inherited from Object.)


Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodReceiveAsync(ArraySegment<Byte>, CancellationToken)

Receives a single message fragment from a remote client.(Overrides WebSocket.ReceiveAsync(ArraySegment<Byte>, CancellationToken).)

System_CAPS_pubmethodSendAsync(ArraySegment<Byte>, WebSocketMessageType, Boolean, CancellationToken)

Sends a single message fragment to a remote client.(Overrides WebSocket.SendAsync(ArraySegment<Byte>, WebSocketMessageType, Boolean, CancellationToken).)


Returns a string that represents the current object.(Inherited from Object.)

.NET Framework
Available since 4.5

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top