Table of Contents

Class HttpRpcClient

Namespace
chia.dotnet
Assembly
chia-dotnet.dll

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 EndpointInfo

Details of the service endpoint

HttpRpcClient(EndpointInfo, DelegatingHandler)

ctor

public HttpRpcClient(EndpointInfo endpoint, DelegatingHandler delegatingHandler)

Parameters

endpoint EndpointInfo

Details of the service endpoint

delegatingHandler DelegatingHandler

A handler created elsewhere that may have things like resiliency chains

HttpRpcClient(EndpointInfo, HttpClient)

ctor

public HttpRpcClient(EndpointInfo endpoint, HttpClient httpClient)

Parameters

endpoint EndpointInfo

Details of the service endpoint

httpClient HttpClient

A 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

disposing bool

Invoke from Dispose()

PostMessage(Message, CancellationToken)

Posts a Message to the Endpoint but does not wait for a response

public Task PostMessage(Message message, CancellationToken cancellationToken = default)

Parameters

message Message

The message to send

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

Awaitable Task

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 Message

The message to send

cancellationToken CancellationToken

A 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