Click or drag to resize

StreamRpcClientHandlerSendAsync Method

[This is preliminary documentation and is subject to change.]

Asynchronously sends a JSON RPC Request message, and wait for the Response (if the Request is not a Notification).

Namespace:  JsonRpc.Streams
Assembly:  JsonRpc.Streams (in JsonRpc.Streams.dll) Version: 0.5.4+1bad715934a0ae5922832940ca44bbbdaa509cfe
Syntax
public override Task<ResponseMessage> SendAsync(
	RequestMessage request,
	CancellationToken cancellationToken
)

Parameters

request
Type: JsonRpc.MessagesRequestMessage
The request message to be sent.
cancellationToken
Type: System.ThreadingCancellationToken
A token used to cancel the transmitting request, or to stop waiting for the Response.

Return Value

Type: TaskResponseMessage
A task that returns JSON RPC response, or null if the Request is a Notification.

Implements

IJsonRpcClientHandlerSendAsync(RequestMessage, CancellationToken)
Exceptions
ExceptionCondition
ArgumentNullExceptionrequest is null.
JsonRpcClientExceptionAn exception has occurred while transmitting the request. Note that a JSON RPC Response with Error will be returned and no exception should be thrown.
Remarks
If a JSON RPC Request has already been sent, cancellation via cancellationToken will only make the returned task stop waiting for the response. To actually notifies the RPC server to cancel certain request, both the client and server side should make a contract on how to cancel an ongoing request, for example, by sending a special "cancellation" notification.
See Also