Method ReceiveMessageAsync
ReceiveMessageAsync(CancellationToken)
Receives a message from the WebSocket endpoint asynchronously.
public ValueTask<WebSocketMessage?> ReceiveMessageAsync(CancellationToken cancellation = default)
Parameters
cancellationCancellationTokenThe CancellationToken to use for cancellation.
Returns
- ValueTask<WebSocketMessage>
A ValueTask<TResult> 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
timeoutTimeSpanThe time to wait for a message before timing out.
Returns
- ValueTask<WebSocketMessage>
A ValueTask<TResult> 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
- ValueTask<WebSocketMessage>
A ValueTask<TResult> that represents the asynchronous receive operation, which returns a WebSocketMessage if a message is received; otherwise,
null.
English
Русский
Português
Español
Deutsch
中文 (简体)
日本語