Share via


IJsonRpcMessageHandler.WriteAsync(JsonRpcMessage, CancellationToken) Method

Definition

Writes a JSON-RPC message to the transport and flushes.

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

Parameters

jsonRpcMessage
JsonRpcMessage

The message to write.

cancellationToken
CancellationToken

A token to cancel the write request.

Returns

A task that represents the asynchronous operation.

Exceptions

Thrown when CanWrite returns false.

Thrown if cancellationToken is canceled before message transmission begins.

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