ClientWebSocket.SendAsync Method (ArraySegment<Byte>, WebSocketMessageType, Boolean, CancellationToken)

.NET Framework (current version)

Send data on ClientWebSocket as an asynchronous operation.

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

public override Task SendAsync(
	ArraySegment<byte> buffer,
	WebSocketMessageType messageType,
	bool endOfMessage,
	CancellationToken cancellationToken


Type: System.ArraySegment<Byte>

The buffer containing the message to be sent.

Type: System.Net.WebSockets.WebSocketMessageType

Specifies whether the buffer is clear text or in a binary format.

Type: System.Boolean

Specifies whether this is the final asynchronous send. Set to true if this is the final send; false otherwise.

Type: System.Threading.CancellationToken

A cancellation token used to propagate notification that this operation should be canceled.

Return Value

Type: System.Threading.Tasks.Task

The task object representing the asynchronous operation.

This operation will not block. The returned Task object will complete after the send request on the ClientWebSocket instance has completed.

.NET Framework
Available since 4.5
Return to top