Create a new OpenClaw client instance.
Client configuration
Get the current connection state.
The current ConnectionState ('disconnected' | 'connecting' | 'ready' | 'closing')
Send a request to the OpenClaw Gateway and wait for a response.
The method name to invoke
Optionalparams: unknownOptional parameters for the method
Optionaloptions: RequestOptionsOptional request options
Promise that resolves with the response payload
Register a handler for connection state changes.
Function to call when connection state changes
Unsubscribe function to remove the handler
Register a handler for incoming gateway frames.
Function to call when a frame is received
Unsubscribe function to remove the handler
OpenClaw Client
Main client class for connecting to and interacting with an OpenClaw Gateway. Provides methods for connection lifecycle, request/response handling, and state queries.