Method
HttpWebSocket.SendAsync
SendAsync(string, CancellationToken) #
Sends an asynchronous text message to the WebSocket endpoint.
public ValueTask<bool> SendAsync(string message, CancellationToken cancellation = default)Parameters #
message string
The text message to send.
cancellation CancellationToken
The CancellationToken to use for cancellation.
Returns #
A ValueTask that represents the asynchronous send operation,
which returns true if the message was sent successfully; otherwise, false.
SendAsync(ReadOnlyMemory<byte>, CancellationToken) #
Sends an asynchronous binary message to the WebSocket endpoint.
public ValueTask<bool> SendAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellation = default)Parameters #
buffer ReadOnlyMemory<byte>
The binary data to send.
cancellation CancellationToken
The CancellationToken to use for cancellation.
Returns #
A ValueTask that represents the asynchronous send operation,
which returns true if the message was sent successfully; otherwise, false.