CUB-200: Implement WebSocket Gateway Client #42
Reference in New Issue
Block a user
Delete Branch "agent/dex/CUB-200-ws-gateway-client"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Replaces the REST poller with a proper WebSocket client speaking the OpenClaw gateway protocol (v3).
Changes
connect.challenge→connect→hello-ok), frame routing (req/res/event), JSON-RPCSend(), auto-reconnect with exponential backoff (1s → 30s max)agents.list+sessions.listRPCs — merges session runtime state intoAgentCardData, broadcastsfleet.updatesessions.changed,presence, andagent.config— DB update first, then SSE broadcastGATEWAY_WS_URLandOPENCLAW_GATEWAY_TOKENenv varsProtocol Flow
ws://<gateway-host>:18789/connect.challenge→ sendconnectwith auth token → receivehello-okagents.list+sessions.listRPCs for initial statesessions.changed,presence,agent.config)AgentCardDataConfig Vars
GATEWAY_WS_URL— WebSocket endpoint (default:ws://host.docker.internal:18789/)OPENCLAW_GATEWAY_TOKEN— auth token for gatewayBuild Verification
go build ./...→ PASSgo vet ./...→ PASSCloses CUB-200