WebSocket.CreateClientWebSocket Method (Stream, String, Int32, Int32, TimeSpan, Boolean, ArraySegment<Byte>)

.NET Framework (current version)

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.

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

static member CreateClientWebSocket : 
        innerStream:Stream *
        subProtocol:string *
        receiveBufferSize:int *
        sendBufferSize:int *
        keepAliveInterval:TimeSpan *
        useZeroMaskingKey:bool *
        internalBuffer:ArraySegment<byte> -> WebSocket


Type: System.IO.Stream

The connection to be used for IO operations.

Type: System.String

The subprotocol accepted by the client.

Type: System.Int32

The size in bytes of the client WebSocket receive buffer.

Type: System.Int32

The size in bytes of the client WebSocket send buffer.

Type: System.TimeSpan

Determines how regularly a frame is sent over the connection as a keep-alive. Applies only when the connection is idle.

Type: System.Boolean

Indicates whether a random key or a static key (just zeros) should be used for the WebSocket masking.

Type: System.ArraySegment<Byte>

Will be used as the internal buffer in the WPC. The size has to be at least 2 * ReceiveBufferSize + SendBufferSize + 256 + 20 (16 on 32-bit).

Return Value

Type: System.Net.WebSockets.WebSocket

Returns WebSocket.

.NET Framework
Available since 4.5
Return to top