Edit

Share via


AspNetWebSocket.ReceiveAsync Method

Definition

Receives a single message fragment from a remote client.

public:
 override System::Threading::Tasks::Task<System::Net::WebSockets::WebSocketReceiveResult ^> ^ ReceiveAsync(ArraySegment<System::Byte> buffer, System::Threading::CancellationToken cancellationToken);
public override System.Threading.Tasks.Task<System.Net.WebSockets.WebSocketReceiveResult> ReceiveAsync (ArraySegment<byte> buffer, System.Threading.CancellationToken cancellationToken);
override this.ReceiveAsync : ArraySegment<byte> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.WebSockets.WebSocketReceiveResult>
Public Overrides Function ReceiveAsync (buffer As ArraySegment(Of Byte), cancellationToken As CancellationToken) As Task(Of WebSocketReceiveResult)

Parameters

buffer
ArraySegment<Byte>

The array that contains the message data.

cancellationToken
CancellationToken

The object that cancels a pending operation.

Returns

A reference to the task of receiving a message.

Exceptions

The AspNetWebSocket object was previously disposed.

The AspNetWebSocket object is in an aborted state.

-or-

Receiving operations are unavailable.

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

Applies to