Problem
The frontend currently polls for notifications every 10 seconds (hooks/useNotifications.ts) and has no real-time escrow status updates. The backend already has a WebSocket gateway (gateways/escrow.gateway.ts) broadcasting events, but the frontend has no WebSocket client.
Current State
- Backend:
EscrowGateway broadcasts events via Socket.IO:
escrow:status_changed, escrow:funded, escrow:completed
escrow:milestone_released, escrow:condition_fulfilled, escrow:condition_confirmed
escrow:dispute_filed, escrow:dispute_resolved
notification:new
- Frontend: No Socket.IO client installed, no WebSocket connection logic
- Frontend:
hooks/useNotifications.ts polls every 10 seconds (inefficient)
Acceptance Criteria
Technical Notes
- Backend Socket.IO namespace:
/escrow (verify in gateway config)
- Auth token passed in
handshake.auth.token or handshake.headers.authorization
- Room format:
escrow:{escrowId}
Points: 150 (Medium)
Problem
The frontend currently polls for notifications every 10 seconds (
hooks/useNotifications.ts) and has no real-time escrow status updates. The backend already has a WebSocket gateway (gateways/escrow.gateway.ts) broadcasting events, but the frontend has no WebSocket client.Current State
EscrowGatewaybroadcasts events via Socket.IO:escrow:status_changed,escrow:funded,escrow:completedescrow:milestone_released,escrow:condition_fulfilled,escrow:condition_confirmedescrow:dispute_filed,escrow:dispute_resolvednotification:newhooks/useNotifications.tspolls every 10 seconds (inefficient)Acceptance Criteria
socket.io-clientas a dependencylib/websocket.tsclient that:providers/WebSocketProvider.tsxthat:hooks/useEscrowEvents.tshook for listening to escrow-specific real-time eventshooks/useNotifications.tsto use WebSocketnotification:newevents instead of pollingTechnical Notes
/escrow(verify in gateway config)handshake.auth.tokenorhandshake.headers.authorizationescrow:{escrowId}Points: 150 (Medium)