Interface: RpcClientProxy
Defined in: packages/rpc/src/types.ts:278
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.
Properties
transportInstance
transportInstance:
RpcTransport
Defined in: packages/rpc/src/types.ts:306
Access to the underlying transport instance. Useful for advanced scenarios like checking connection status.
Example
const client = createRpcClient<MyDO>({
transport: createWebSocketTransport('MY_DO', 'instance-name')
});
const isConnected = client.transportInstance.isConnected?.() ?? false;
Methods
__asObject()?
optional__asObject():Promise<any>
Defined in: packages/rpc/src/types.ts:330
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>({
transport: createWebSocketTransport('MY_DO', 'instance-name')
});
const structure = await client.__asObject();
// {
// increment: "increment [Function]",
// ctx: {
// storage: {
// get: "get [Function]",
// ...
// }
// }
// }
[dispose]()
[dispose]():
void
Defined in: packages/rpc/src/types.ts:292
Automatic cleanup when using 'using' syntax. Disconnects WebSocket synchronously (ws.close() is synchronous).
Returns
void
Example
using client = createRpcClient<MyDO>({
transport: createWebSocketTransport('MY_DO', 'instance-name')
});
// Use client here - auto-connects on first method call
// disconnect() called automatically at end of scope