The client owns reconnection after a connection that opened then dropped (
800 ms → 15 s backoff). It negotiates the OpenClaw connect protocol (minProtocol: 3, maxProtocol: 4) and signs the connect frame with Ed25519 device auth in the browser (via crypto.subtle), or through an injected signConnect hook for Node callers. The device-auth module is internal and not re-exported.
Public API
Classes
GatewayClient typed RPC namespaces (instance fields, not separate exports):
Functions
Types & interfaces
Errors
The package exports no runtime constants from its barrel. The connect protocol range (
minProtocol: 3, maxProtocol: 4), retry constants, and close codes are private to client.ts / helpers.ts.Used by
apps/web/src/stores/connection.ts, holds the liveGatewayClientinstance (ConnectionStatussuperset adds an'error'state).apps/web/src/features/connection/{GatewayBootstrap,GatewayConnectScreen,useGatewayEvents}.tsx?, connect/reconnect lifecycle and event subscription;GatewayResponseError.codedrives theNOT_PAIREDpairing branch.apps/web/server/lib/agentSource/registry.ts, the server-sideOpenClawAgentSourceconnection injectsWebSocketLikeCtor+signConnectfor Node device auth.apps/web/server/lib/capabilitySource/openclaw.ts, usesencodeConfigPatchParamsfor theconfig.patchenvelope.packages/events/src/{index,bridge,types}.ts, consumes theEventFrame/AgentStatus/ConnectionStatustypes in the Bridge → Policy → Handler pipeline.packages/adapters/openclaw/src/{adapter,mapFrame,types}.ts, mapsEventFrame/AgentsListResult/SessionPatchResultinto the normalizedRuntimeEventstream.
Source
Barrel:packages/gateway-client/src/index.ts. Modules: types.ts (frame + domain + connect types), errors.ts (GatewayResponseError), client.ts (the GatewayClient class), helpers.ts (frame/session/url/error/retry helpers). device-auth.ts is internal and not re-exported.
See also
- Gateway & events pipeline, how frames flow Bridge → Policy → Handler.
- @clawboo/events, the consumer that turns
EventFrames into store mutations. - @clawboo/adapter-openclaw, the RuntimeAdapter wrapping this client.
- @clawboo/gateway-proxy, the same-origin WS proxy + the
signConnectParamsserver wires tosignConnect. - OpenClaw runtime, device pairing and channels.