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

.NET Framework (current version)
 
System_CAPS_noteNote

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

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)

public static WebSocket CreateClientWebSocket(
	Stream innerStream,
	string subProtocol,
	int receiveBufferSize,
	int sendBufferSize,
	TimeSpan keepAliveInterval,
	bool useZeroMaskingKey,
	ArraySegment<byte> internalBuffer
)

Parameters

innerStream
Type: System.IO.Stream

The connection to be used for IO operations.

subProtocol
Type: System.String

The subprotocol accepted by the client.

receiveBufferSize
Type: System.Int32

The size in bytes of the client WebSocket receive buffer.

sendBufferSize
Type: System.Int32

The size in bytes of the client WebSocket send buffer.

keepAliveInterval
Type: System.TimeSpan

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

useZeroMaskingKey
Type: System.Boolean

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

internalBuffer
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
Show: