System.Net.WebSockets The WebSocket class allows applications to send and receive data after the WebSocket upgrade has completed. Creates an instance of the class. Aborts the WebSocket connection and cancels any pending IO operations. Closes the WebSocket connection as an asynchronous operation using the close handshake defined in the WebSocket protocol specification section 7. Returns .The task object representing the asynchronous operation. Indicates the reason for closing the WebSocket connection. Specifies a human readable explanation as to why the connection is closed. The token that can be used to propagate notification that operations should be canceled. Initiates or completes the close handshake defined in the WebSocket protocol specification section 7. Returns .The task object representing the asynchronous operation. Indicates the reason for closing the WebSocket connection. Allows applications to specify a human readable explanation as to why the connection is closed. The token that can be used to propagate notification that operations should be canceled. Indicates the reason why the remote endpoint initiated the close handshake. Returns . Allows the remote endpoint to describe the reason why the connection was closed. Returns . Used to clean up unmanaged resources for ASP.NET and self-hosted implementations. Receives data from the WebSocket connection asynchronously. Returns .The task object representing the asynchronous operation. The property on the task object returns a array containing the received data. References the application buffer that is the storage location for the received data. Propagate the notification that operations should be canceled. Sends data over the WebSocket connection asynchronously. Returns .The task object representing the asynchronous operation. The buffer to be sent over the connection. Indicates whether the application is sending a binary or text message. Indicates whether the data in “buffer” is the last part of a message. The token that propagates the notification that operations should be canceled. Returns the current state of the WebSocket connection. Returns . The subprotocol that was negotiated during the opening handshake. Returns . Represents well known WebSocket close codes as defined in section 11.7 of the WebSocket protocol spec. No error specified. (1001) Indicates an endpoint is being removed. Either the server or client will become unavailable. The connection will be closed by the server because of an error on the server. (1003) The client or server is terminating the connection because it cannot accept the data type it received. (1007) The client or server is terminating the connection because it has received data inconsistent with the message type. (1010) The client is terminating the connection because it expected the server to negotiate an extension. (1004) Reserved for future use. (1000) The connection has closed after the request was fulfilled. (1008) The connection will be closed because an endpoint has received a message that violates its policy. (1002) The client or server is terminating the connection because of a protocol error. Contains the list of possible WebSocket errors. Indicates that the connection was terminated unexpectedly. Indicates a general error. Indicates an error occurred when parsing the HTTP headers during the opening handshake. Indicates that a WebSocket frame with an unknown opcode was received. Indicates the WebSocket is an invalid state for the given operation (such as being closed or aborted). Indicates that an unknown native error occurred. Indicates that the incoming request was not a valid websocket request. Indicates that there was no native error information for the exception. Indicates that the client requested an unsupported WebSocket subprotocol. Indicates that the client requested an unsupported version of the WebSocket protocol. Represents an exception that occurred when performing an operation on a WebSocket connection. Creates an instance of the class. The native error code for the exception. Creates an instance of the class. The native error code for the exception. Indicates the previous exception that led to the current exception. Creates an instance of the class. The native error code for the exception. The description of the error. Creates an instance of the class. The error from the WebSocketError enumeration. Creates an instance of the class. The error from the WebSocketError enumeration. Indicates the previous exception that led to the current exception. Creates an instance of the class. The error from the WebSocketError enumeration. The native error code for the exception. Creates an instance of the class. The error from the WebSocketError enumeration. The native error code for the exception. Indicates the previous exception that led to the current exception. Creates an instance of the class. The error from the WebSocketError enumeration. The native error code for the exception. The description of the error. Creates an instance of the class. The error from the WebSocketError enumeration. The native error code for the exception. The description of the error. Indicates the previous exception that led to the current exception. Creates an instance of the class. The error from the WebSocketError enumeration. The description of the error. Creates an instance of the class. The error from the WebSocketError enumeration. The description of the error. Indicates the previous exception that led to the current exception. Creates an instance of the class. The description of the error. Creates an instance of the class. The description of the error. Indicates the previous exception that led to the current exception. The native error code for the exception that occurred. Returns . Returns a WebSocketError indicating the type of error that occurred. Returns . Indicates the message type. The message is in binary format. A receive has completed because a close message was received. The message is clear text. An instance of this class represents the result of performing a single ReceiveAsync operation on a WebSocket. Creates an instance of the class. The number of bytes received. The type of message that was received. Indicates whether this is the final message. Creates an instance of the class. The number of bytes received. The type of message that was received. Indicates whether this is the final message. Indicates the of the connection. The description of . Indicates the reason why the remote endpoint initiated the close handshake. Returns . Returns the optional description that describes why the close handshake has been initiated by the remote endpoint. Returns . Indicates the number of bytes that the WebSocket received. Returns . Indicates whether the message has been received completely. Returns . Indicates whether the current message is a UTF-8 message or a binary message. Returns . Defines the different states a WebSockets instance can be in. Reserved for future use. Indicates the WebSocket close handshake completed gracefully. A close message was received from the remote endpoint. A close message was sent to the remote endpoint. The connection is negotiating the handshake with the remote endpoint. Reserved for future use. The initial state after the HTTP handshake has been completed.