MessageHandlerBase.WriteAsync(JsonRpcMessage, CancellationToken) Method

Definition

Writes a message to the transport and flushes.

public System.Threading.Tasks.ValueTask WriteAsync (StreamJsonRpc.Protocol.JsonRpcMessage content, System.Threading.CancellationToken cancellationToken);
abstract member WriteAsync : StreamJsonRpc.Protocol.JsonRpcMessage * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
override this.WriteAsync : StreamJsonRpc.Protocol.JsonRpcMessage * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
Public Function WriteAsync (content As JsonRpcMessage, cancellationToken As CancellationToken) As ValueTask

Parameters

content
JsonRpcMessage

The message to write.

cancellationToken
CancellationToken

A token to cancel the write request.

Returns

A task that represents the asynchronous operation.

Implements

Exceptions

Thrown when CanWrite returns false.

Thrown if cancellationToken is canceled before message transmission begins.

Thrown if this instance is disposed before or during transmission.

Remarks

Implementations should expect this method to be invoked concurrently and use a queue to preserve message order as they are transmitted one at a time.

Applies to