ClientWebSocket.ReceiveAsync Method

.NET Framework 4.5

Receive data on ClientWebSocket as an asynchronous operation.

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

public override Task<WebSocketReceiveResult> ReceiveAsync(
	ArraySegment<byte> buffer,
	CancellationToken cancellationToken


Type: System.ArraySegment<Byte>

The buffer to receive the response.

Type: System.Threading.CancellationToken

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

Return Value

Type: System.Threading.Tasks.Task<WebSocketReceiveResult>
Returns Task<TResult>.
The task object representing the asynchronous operation.

This operation will not block. The returned Task<TResult> object will complete after the receive 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