AspNetWebSocket.SendAsync Method

Definition

Sends a single message fragment to a remote client.

public:
 override System::Threading::Tasks::Task ^ SendAsync(ArraySegment<System::Byte> buffer, System::Net::WebSockets::WebSocketMessageType messageType, bool endOfMessage, System::Threading::CancellationToken cancellationToken);
public override System.Threading.Tasks.Task SendAsync (ArraySegment<byte> buffer, System.Net.WebSockets.WebSocketMessageType messageType, bool endOfMessage, System.Threading.CancellationToken cancellationToken);
override this.SendAsync : ArraySegment<byte> * System.Net.WebSockets.WebSocketMessageType * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overrides Function SendAsync (buffer As ArraySegment(Of Byte), messageType As WebSocketMessageType, endOfMessage As Boolean, cancellationToken As CancellationToken) As Task

Parameters

buffer
ArraySegment<Byte>

The array that contains the message data.

messageType
WebSocketMessageType

The message type.

endOfMessage
Boolean

true to indicate that a fragment is the end of a complete message; otherwise, false.

cancellationToken
CancellationToken

The object that cancels a pending operation.

Returns

A reference to the task of sending a message.

Exceptions

The AspNetWebSocket object is disposed.

The AspNetWebSocket object is in an aborted state.

-or-

Sending operations are unavailable.

The cancellation token was canceled. This exception is stored into the returned task.

Applies to