fix(gateway): implement proper OpenClaw WebSocket handshake protocol

- Send JSON-RPC connect request after WebSocket opens (required by OpenClaw Gateway)
- Use OpenClaw protocol format: { type: "req" } instead of { jsonrpc: "2.0" }
- Include proper ConnectParams: client info, auth token, protocol version
- Handle OpenClaw response format: { type: "res", ok: true/false }
- Handle OpenClaw event format: { type: "event", event: "..." }
- Wait for handshake completion before marking connection as running
- Improve error handling for connection failures

The Gateway was rejecting connections because:
1. ClawX wasn't sending the required "connect" handshake message
2. The protocol format was incorrect (standard JSON-RPC vs OpenClaw format)
This commit is contained in:
Haze
2026-02-06 02:17:43 +08:00
Unverified
parent 931fea3735
commit 0f8e6f3f9e
3 changed files with 224 additions and 17 deletions

View File

@@ -20,6 +20,7 @@
* [commit_12] Real API key validation - OpenRouter support, actual API calls to verify keys
* [commit_13] Remove channel setup step - Simplified onboarding, channels moved to Settings
* [commit_14] Auto-install skills step - Replace skill selection with auto-installation progress UI
* [commit_15] Fix Gateway WebSocket handshake - Implement proper OpenClaw protocol
### Plan:
1. ~~Initialize project structure~~
@@ -50,6 +51,7 @@ All core features have been implemented:
- Real API key validation via actual API calls (Anthropic, OpenAI, Google, OpenRouter)
- Simplified setup wizard (channel connection deferred to Settings page)
- Auto-install skills step with real-time progress UI (no manual skill selection)
- Fixed Gateway WebSocket connection with proper OpenClaw handshake protocol
## Version Milestones