WebSocket.CreateClientWebSocket Method

.NET Framework 4.5

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

Supported in: 4.5.2, 4.5.1, 4.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft