An OpenClaw-compatible WebSocket gateway server built on the agentic framework.
This example implements the OpenClaw Gateway Protocol, providing a JSON-over-WebSocket gateway with:
- Device authentication — Ed25519 signature-based device identity
- Token/password auth — Static token or password authentication
- Tick/keepalive — Server-emitted tick events for connection health
- Sequence tracking — Monotonic sequence numbers with gap detection
- Method dispatch — RPC-style request/response with
connect,send,config.*, andagent.*methods - Idempotency — Deduplication cache for side-effecting operations
./agentic examples/openclaw/config.yaml consoleThe gateway server runs as a WebSocket server (default: ws://127.0.0.1:18789/ws).
See the gateway server documentation for full protocol details.
| Frame | Direction | Fields |
|---|---|---|
| Request | Client → Server | type:"req", id, method, params? |
| Response | Server → Client | type:"res", id, ok, payload?, error? |
| Event | Server → Client | type:"event", event, payload?, seq?, stateVersion? |
{
"type": "req",
"id": "uuid-v4",
"method": "connect",
"params": {
"minProtocol": 3,
"maxProtocol": 3,
"client": { "id": "my-client", "version": "1.0" },
"role": "operator",
"scopes": ["operator.admin"],
"auth": { "token": "my-token" }
}
}connect— Handshake and authenticationsend— Broadcast messages to other clientsconfig.get— Get server configurationconfig.schema— Get configuration schemaagent.*— Forward to ADK agent for processing
Client (WebSocket) ──→ Gateway Server ──→ Method Dispatch
├── connect (auth, device tokens)
├── send (broadcast, dedup)
├── config.* (server config)
└── agent.* (ADK agent invocation)