Commit Graph

1 Commits

  • 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)