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

.NET Framework (current version)
 

Sends data over the WebSocket connection asynchronously.

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

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

Parameters

buffer
Type: System.ArraySegment<Byte>

The buffer to be sent over the connection.

messageType
Type: System.Net.WebSockets.WebSocketMessageType

Indicates whether the application is sending a binary or text message.

endOfMessage
Type: System.Boolean

Indicates whether the data in “buffer” is the last part of a message.

cancellationToken
Type: System.Threading.CancellationToken

The token that propagates the notification that operations 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 data has been sent on the WebSocket.

Exactly one send and one receive is supported on each WebSocket object in parallel.

.NET Framework
Available since 4.5
Return to top
Show: