--- id: integration-test-ws-client-server name: "Integration test: WebSocket client and server event targets together" status: pending depends_on: [websocket-client-tests, websocket-server-tests] scope: moderate risk: medium impact: component level: implementation --- ## Description Test the WebSocket client and server adapters working together — a spoke subscribes via the client adapter, the hub fans out via the server adapter. This validates the full subscription control protocol end-to-end: 1. Client connects to server 2. Client calls `addEventListener` → sends `__subscribe` to server 3. Server receives `__subscribe` → adds client to subscription map 4. Server `dispatchEvent` on that topic → message sent only to subscribed client 5. Client receives message → dispatches to local listeners 6. Client calls `removeEventListener` → sends `__unsubscribe` to server 7. Server removes client from subscription map This is also where we validate that `createPubSub` works with the WebSocket adapters. ## Acceptance Criteria - [ ] Integration test: bidirectional communication between WS client and server - [ ] Integration test: subscription control protocol end-to-end - [ ] Integration test: topic-based fan-out — subscribed clients receive events, unsubscribed don't - [ ] Integration test: direct messaging via topic scoping `"direct:${spokeId}"` - [ ] Integration test: `createPubSub` works with WS client event target - [ ] Integration test: `createPubSub` works with WS server event target ## References - docs/architecture/event-targets/websocket-client.md - docs/architecture/event-targets/websocket-server.md - docs/architecture/decisions/003-subscription-control-protocol.md ## Notes > To be filled by implementation agent ## Summary > To be filled on completion