Class HttpRpcClient
Class that handles core communication with the rpc endpoint using http(s)
public class HttpRpcClient : IRpcClient, IDisposable
- Inheritance
-
HttpRpcClient
- Implements
- Inherited Members
- Extension Methods
Constructors
HttpRpcClient(EndpointInfo)
ctor
public HttpRpcClient(EndpointInfo endpoint)
Parameters
endpoint
EndpointInfoDetails of the service endpoint
HttpRpcClient(EndpointInfo, DelegatingHandler)
ctor
public HttpRpcClient(EndpointInfo endpoint, DelegatingHandler delegatingHandler)
Parameters
endpoint
EndpointInfoDetails of the service endpoint
delegatingHandler
DelegatingHandlerA handler created elsewhere that may have things like resiliency chains
HttpRpcClient(EndpointInfo, HttpClient)
ctor
public HttpRpcClient(EndpointInfo endpoint, HttpClient httpClient)
Parameters
endpoint
EndpointInfoDetails of the service endpoint
httpClient
HttpClientA fully configured client, including ssl certs, in tended for use with IHttpClientFactory
Properties
Endpoint
Details of the RPC service endpoint
public EndpointInfo Endpoint { get; init; }
Property Value
- EndpointInfo
- Class that handles core communication with the rpc endpoint using http(s)
Methods
Dispose()
public void Dispose()
Dispose(bool)
Called when the instance is being disposed or finalized
protected virtual void Dispose(bool disposing)
Parameters
PostMessage(Message, CancellationToken)
public Task PostMessage(Message message, CancellationToken cancellationToken = default)
Parameters
message
MessageThe message to send
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
Remarks
Awaiting this method waits for the message to be sent only. It doesn't await a response.
SendMessage(Message, CancellationToken)
Sends a Message to the endpoint and waits for a response
public Task<dynamic> SendMessage(Message message, CancellationToken cancellationToken = default)
Parameters
message
MessageThe message to send
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<dynamic>
The response message
Remarks
Awaiting this method will block until a response is received from the rpc endpoint or the A token to allow the call to be cancelled is cancelled
Exceptions
- ResponseException
Throws when IsSuccessfulResponse is False