Skip to main content
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 live GatewayClient instance (ConnectionStatus superset adds an 'error' state).
  • apps/web/src/features/connection/{GatewayBootstrap,GatewayConnectScreen,useGatewayEvents}.tsx?, connect/reconnect lifecycle and event subscription; GatewayResponseError.code drives the NOT_PAIRED pairing branch.
  • apps/web/server/lib/agentSource/registry.ts, the server-side OpenClawAgentSource connection injects WebSocketLikeCtor + signConnect for Node device auth.
  • apps/web/server/lib/capabilitySource/openclaw.ts, uses encodeConfigPatchParams for the config.patch envelope.
  • packages/events/src/{index,bridge,types}.ts, consumes the EventFrame / AgentStatus / ConnectionStatus types in the Bridge → Policy → Handler pipeline.
  • packages/adapters/openclaw/src/{adapter,mapFrame,types}.ts, maps EventFrame / AgentsListResult / SessionPatchResult into the normalized RuntimeEvent stream.

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

Last modified on June 26, 2026