Table of Contents

Class OpenClawRpcClient

Namespace
JD.AI.Channels.OpenClaw
Assembly
JD.AI.Channels.OpenClaw.dll

JSON-RPC-over-WebSocket client for communicating with an OpenClaw gateway. Implements the OpenClaw v3 protocol: challenge-response device auth with Ed25519 signatures, typed request/response/event frames, and automatic reconnection.

public sealed class OpenClawRpcClient : IAsyncDisposable
Inheritance
OpenClawRpcClient
Implements
Inherited Members

Constructors

OpenClawRpcClient(OpenClawConfig, ILogger<OpenClawRpcClient>)

public OpenClawRpcClient(OpenClawConfig config, ILogger<OpenClawRpcClient> logger)

Parameters

config OpenClawConfig
logger ILogger<OpenClawRpcClient>

Properties

IsConnected

Whether the client is connected and authenticated.

public bool IsConnected { get; }

Property Value

bool

Methods

ConnectAsync(CancellationToken)

Connects to the OpenClaw gateway, performs challenge-response device authentication, and starts the receive loop.

public Task ConnectAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task

DisconnectAsync()

Gracefully disconnects from the gateway.

public Task DisconnectAsync()

Returns

Task

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

RequestAsync(string, object?, CancellationToken)

Sends an RPC request and waits for the response.

public Task<RpcResponse> RequestAsync(string method, object? parameters = null, CancellationToken ct = default)

Parameters

method string
parameters object
ct CancellationToken

Returns

Task<RpcResponse>

Events

EventReceived

Raised when an event frame is received from the gateway.

public event Action<OpenClawEvent>? EventReceived

Event Type

Action<OpenClawEvent>