mscorlib(4.0.0.0) API with additions
System.Net.WebSockets Namespace Reference

Classes

class  ClientWebSocket
 Provides a client for connecting to WebSocket services. More...
 
class  ClientWebSocketOptions
 Options to use with a T:System.Net.WebSockets.ClientWebSocket object. More...
 
class  HttpListenerWebSocketContext
 Provides access to information received by the T:System.Net.HttpListener class when accepting WebSocket connections. More...
 
class  WebSocket
 The WebSocket class allows applications to send and receive data after the WebSocket upgrade has completed. More...
 
class  WebSocketContext
 Used for accessing the information in the WebSocket handshake. More...
 
class  WebSocketException
 Represents an exception that occurred when performing an operation on a WebSocket connection. More...
 
class  WebSocketReceiveResult
 An instance of this class represents the result of performing a single ReceiveAsync operation on a WebSocket. More...
 

Enumerations

enum  WebSocketCloseStatus {
  WebSocketCloseStatus.NormalClosure = 1000, WebSocketCloseStatus.EndpointUnavailable = 1001, WebSocketCloseStatus.ProtocolError = 1002, WebSocketCloseStatus.InvalidMessageType = 1003,
  WebSocketCloseStatus.Empty = 1005, WebSocketCloseStatus.InvalidPayloadData = 1007, WebSocketCloseStatus.PolicyViolation = 1008, WebSocketCloseStatus.MessageTooBig = 1009,
  WebSocketCloseStatus.MandatoryExtension = 1010, WebSocketCloseStatus.InternalServerError = 1011
}
 Represents well known WebSocket close codes as defined in section 11.7 of the WebSocket protocol spec. More...
 
enum  WebSocketError {
  WebSocketError.Success, WebSocketError.InvalidMessageType, WebSocketError.Faulted, WebSocketError.NativeError,
  WebSocketError.NotAWebSocket, WebSocketError.UnsupportedVersion, WebSocketError.UnsupportedProtocol, WebSocketError.HeaderError,
  WebSocketError.ConnectionClosedPrematurely, WebSocketError.InvalidState
}
 Contains the list of possible WebSocket errors. More...
 
enum  WebSocketMessageType { WebSocketMessageType.Text, WebSocketMessageType.Binary, WebSocketMessageType.Close }
 Indicates the message type. More...
 
enum  WebSocketState {
  WebSocketState.None, WebSocketState.Connecting, WebSocketState.Open, WebSocketState.CloseSent,
  WebSocketState.CloseReceived, WebSocketState.Closed, WebSocketState.Aborted
}
 Defines the different states a WebSockets instance can be in. More...
 

Enumeration Type Documentation

◆ WebSocketCloseStatus

Represents well known WebSocket close codes as defined in section 11.7 of the WebSocket protocol spec.

Enumerator
NormalClosure 

(1000) The connection has closed after the request was fulfilled.

EndpointUnavailable 

(1001) Indicates an endpoint is being removed. Either the server or client will become unavailable.

ProtocolError 

(1002) The client or server is terminating the connection because of a protocol error.

InvalidMessageType 

(1003) The client or server is terminating the connection because it cannot accept the data type it received.

Empty 

No error specified.

InvalidPayloadData 

(1007) The client or server is terminating the connection because it has received data inconsistent with the message type.

PolicyViolation 

(1008) The connection will be closed because an endpoint has received a message that violates its policy.

MessageTooBig 

(1004) Reserved for future use.

MandatoryExtension 

(1010) The client is terminating the connection because it expected the server to negotiate an extension.

InternalServerError 

The connection will be closed by the server because of an error on the server.

Definition at line 4 of file WebSocketCloseStatus.cs.

◆ WebSocketError

Contains the list of possible WebSocket errors.

Enumerator
Success 

Indicates that there was no native error information for the exception.

InvalidMessageType 

Indicates that a WebSocket frame with an unknown opcode was received.

Faulted 

Indicates a general error.

NativeError 

Indicates that an unknown native error occurred.

NotAWebSocket 

Indicates that the incoming request was not a valid websocket request.

UnsupportedVersion 

Indicates that the client requested an unsupported version of the WebSocket protocol.

UnsupportedProtocol 

Indicates that the client requested an unsupported WebSocket subprotocol.

HeaderError 

Indicates an error occurred when parsing the HTTP headers during the opening handshake.

ConnectionClosedPrematurely 

Indicates that the connection was terminated unexpectedly.

InvalidState 

Indicates the WebSocket is an invalid state for the given operation (such as being closed or aborted).

Definition at line 4 of file WebSocketError.cs.

◆ WebSocketMessageType

Indicates the message type.

Enumerator
Text 

The message is clear text.

Binary 

The message is in binary format.

Close 

A receive has completed because a close message was received.

Definition at line 4 of file WebSocketMessageType.cs.

◆ WebSocketState

Defines the different states a WebSockets instance can be in.

Enumerator
None 

Reserved for future use.

Connecting 

The connection is negotiating the handshake with the remote endpoint.

Open 

The initial state after the HTTP handshake has been completed.

CloseSent 

A close message was sent to the remote endpoint.

CloseReceived 

A close message was received from the remote endpoint.

Closed 

Indicates the WebSocket close handshake completed gracefully.

Aborted 

Reserved for future use.

Definition at line 4 of file WebSocketState.cs.