/ws (default ws://localhost:8081/ws). It fans out Redis pubsub messages from the quote-worker to subscribed clients.
Protocol
Client → server messages:Lifecycle
- Client subscribes → hub joins it to the Redis pubsub channel.
- Quote-worker polls
predict::get_trade_amountsfor hot strikes (default 2s interval viaQUOTE_POLL_MS). - On change, worker
PUBLISHes toquotes:v1:<oracle>:<strike>. - Hub fans out to all subscribed sockets.
- After 30s idle (no subscribers), the channel closes.
Frontend integration
packages/frontend/src/lib/realtime.ts is a singleton WS client with:
- Per-channel subscribe / unsubscribe (
useQuoteSubscriptionhook) - Linear-backoff reconnect on disconnect
- Idle-close after 30s with no active subscribers
useQuoteSubscription hook. It auto-subscribes on mount and cleans up on unmount.
Other deferred upgrades
The current realtime stack is poll-based: 5s client devInspect for event-market books, 2s server poll for Predict quotes. The designed-but-deferred upgrade (1s server-side book poll → Redis → WS; oracle-event-triggered strike requotes; DeepBook order-event tape) is documented in the 2026-06-12 decision log but won’t ship before the hackathon submission.Channel naming
quotes:v1:<oracleId>:<strike>. Per-strike quote- (future)
book:v1:<poolId>. DeepBook V3 level-2 ticks - (future)
fills:v1:<oracleId>. Per-oracle fill tape