Method
HttpWebSocket.ReceiveMessageAsync
ReceiveMessageAsync(CancellationToken) #
Receives a message from the WebSocket endpoint asynchronously.
public ValueTask<WebSocketMessage?> ReceiveMessageAsync(CancellationToken cancellation = default)Parameters #
cancellation CancellationToken
The CancellationToken to use for cancellation.
Returns #
A ValueTask that represents the asynchronous receive operation,
which returns a WebSocketMessage if a message is received; otherwise, null.
ReceiveMessageAsync(TimeSpan) #
Receives a message from the WebSocket endpoint asynchronously with a specified timeout.
public ValueTask<WebSocketMessage?> ReceiveMessageAsync(TimeSpan timeout)Parameters #
timeout TimeSpan
The time to wait for a message before timing out.
Returns #
A ValueTask that represents the asynchronous receive operation,
which returns a WebSocketMessage if a message is received; otherwise, null.
ReceiveMessageAsync() #
Receives a message from the WebSocket endpoint asynchronously with a default timeout of 30 seconds.
public ValueTask<WebSocketMessage?> ReceiveMessageAsync()Returns #
A ValueTask that represents the asynchronous receive operation,
which returns a WebSocketMessage if a message is received; otherwise, null.