WebSocket Class

WebSocket Class

.NET Framework (current version)
 

The WebSocket class allows applications to send and receive data after the WebSocket upgrade has completed.

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


[<AbstractClass>]
type WebSocket = 
    class
        interface IDisposable
    end

NameDescription
System_CAPS_protmethodWebSocket()

Creates an instance of the WebSocket class.

NameDescription
System_CAPS_pubpropertyCloseStatus

Indicates the reason why the remote endpoint initiated the close handshake.

System_CAPS_pubpropertyCloseStatusDescription

Allows the remote endpoint to describe the reason why the connection was closed.

System_CAPS_pubpropertySystem_CAPS_staticDefaultKeepAliveInterval

Gets the default WebSocket protocol keep-alive interval in milliseconds.

System_CAPS_pubpropertyState

Returns the current state of the WebSocket connection.

System_CAPS_pubpropertySubProtocol

The subprotocol that was negotiated during the opening handshake.

NameDescription
System_CAPS_pubmethodAbort()

Aborts the WebSocket connection and cancels any pending IO operations.

System_CAPS_pubmethodCloseAsync(WebSocketCloseStatus, String, CancellationToken)

Closes the WebSocket connection as an asynchronous operation using the close handshake defined in the WebSocket protocol specification section 7.

System_CAPS_pubmethodCloseOutputAsync(WebSocketCloseStatus, String, CancellationToken)

Initiates or completes the close handshake defined in the WebSocket protocol specification section 7.

System_CAPS_pubmethodSystem_CAPS_staticCreateClientBuffer(Int32, Int32)

Create client buffers to use with this WebSocket instance.

System_CAPS_pubmethodSystem_CAPS_staticCreateClientWebSocket(Stream, String, Int32, Int32, TimeSpan, Boolean, ArraySegment<Byte>)

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Allows callers to create a client side WebSocket class which will use the WSPC for framing purposes.

System_CAPS_pubmethodSystem_CAPS_staticCreateServerBuffer(Int32)

Creates a WebSocket server buffer.

System_CAPS_pubmethodDispose()

Used to clean up unmanaged resources for ASP.NET and self-hosted implementations.

System_CAPS_pubmethodEquals(Object)

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

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

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

System_CAPS_pubmethodGetType()

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

System_CAPS_pubmethodSystem_CAPS_staticIsApplicationTargeting45()

Obsolete.Returns a value that indicates if the WebSocket instance is targeting .NET Framework 4.5.

System_CAPS_protmethodSystem_CAPS_staticIsStateTerminal(WebSocketState)

Returns a value that indicates if the state of the WebSocket instance is closed or aborted.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodReceiveAsync(ArraySegment<Byte>, CancellationToken)

Receives data from the WebSocket connection asynchronously.

System_CAPS_pubmethodSystem_CAPS_staticRegisterPrefixes()

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code. Allows callers to register prefixes for WebSocket requests (ws and wss).

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

Sends data over the WebSocket connection asynchronously.

System_CAPS_protmethodSystem_CAPS_staticThrowOnInvalidState(WebSocketState, WebSocketState[])

Verifies that the connection is in an expected state.

System_CAPS_pubmethodToString()

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

Some of the classes in the System.Net.WebSockets namespace are supported on Windows 7, Windows Vista SP2, and Windows Server 2008. However, the only public implementations of client and server WebSockets are supported on Windows 8 and Windows Server 2012. The classes and class elements in the System.Net.WebSockets namespace that are supported on Windows 7, Windows Vista SP2, and Windows Server 2008 are abstract classes. This allows an application developer to inherit and extend these abstract classes with an actual implementation of client WebSockets.

.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
Show:
© 2016 Microsoft