ClientWebSocket.SendAsync Method

.NET Framework 4.6 and 4.5

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
Returns 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

Supported in: 4.6, 4.5
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft