Skip to main content

Interface: RpcClientProxy

Defined in: packages/rpc/src/types.ts:208

Lifecycle methods added to the RPC client proxy by createRpcClient().

These methods are mixed into the returned proxy object alongside the Durable Object's own methods to provide connection management and debugging.

Methods

__asObject()?

optional __asObject(): Promise<any>

Defined in: packages/rpc/src/types.ts:242

Returns a plain object representation of the proxied object with functions represented as readable strings like "functionName [Function]". Useful for debugging and testing.

Returns

Promise<any>

Example

const client = createRpcClient<MyDO>('MY_DO', 'instance-name');
const structure = await client.__asObject();
// {
// increment: "increment [Function]",
// ctx: {
// storage: {
// get: "get [Function]",
// ...
// }
// }
// }

[asyncDispose]()

[asyncDispose](): Promise<void>

Defined in: packages/rpc/src/types.ts:220

Automatic cleanup when using 'await using' syntax. Disconnects and cleans up transport resources automatically when the client goes out of scope.

Returns

Promise<void>

Example

await using client = createRpcClient<MyDO>('MY_DO', 'instance-name');
// Use client here - auto-connects on first method call
// disconnect() called automatically at end of scope