JsonRpc.DispatchRequestAsync Method

Definition

Invokes the method on the local RPC target object and converts the response into a JSON-RPC result message.

protected virtual System.Threading.Tasks.ValueTask<StreamJsonRpc.Protocol.JsonRpcMessage> DispatchRequestAsync (StreamJsonRpc.Protocol.JsonRpcRequest request, StreamJsonRpc.TargetMethod targetMethod, System.Threading.CancellationToken cancellationToken);
abstract member DispatchRequestAsync : StreamJsonRpc.Protocol.JsonRpcRequest * StreamJsonRpc.TargetMethod * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<StreamJsonRpc.Protocol.JsonRpcMessage>
override this.DispatchRequestAsync : StreamJsonRpc.Protocol.JsonRpcRequest * StreamJsonRpc.TargetMethod * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<StreamJsonRpc.Protocol.JsonRpcMessage>
Protected Overridable Function DispatchRequestAsync (request As JsonRpcRequest, targetMethod As TargetMethod, cancellationToken As CancellationToken) As ValueTask(Of JsonRpcMessage)

Parameters

request
JsonRpcRequest

The incoming JSON-RPC request that resulted in the targetMethod being selected to receive the dispatch.

targetMethod
TargetMethod

The method to be invoked and the arguments to pass to it.

cancellationToken
CancellationToken

A cancellation token to pass to StreamJsonRpc.TargetMethod.InvokeAsync(System.Threading.CancellationToken).

Returns

The JSON-RPC response message to send back to the client. This is never expected to be null. If the protocol indicates no response message is expected by the client, it will be dropped rather than transmitted.

Remarks

Overrides of this method are expected to call this base method for core functionality. Overrides should call the base method before any yielding await in order to maintain consistent message ordering unless the goal of the override is specifically to alter ordering of incoming messages.

Applies to