Description
Optimize WebSocket data streaming by computing JSON Patches (RFC 6902) on the backend and transmitting only the state deltas to the frontend order book.
Architecture & Context
Broadcasting the entire fractional order book every 3 seconds consumes massive egress bandwidth. Computing a diff against the client's last known state ensures only changing orders are transmitted over the WebSocket.
Technical Requirements
- Maintain an ephemeral state hash map per connected WebSocket client.
- Implement an efficient JSON diffing algorithm on the Fastify server.
- Reconstruct the full object state seamlessly in the Next.js frontend using
immer or manual patching.
Acceptance Criteria
Description
Optimize WebSocket data streaming by computing JSON Patches (RFC 6902) on the backend and transmitting only the state deltas to the frontend order book.
Architecture & Context
Broadcasting the entire fractional order book every 3 seconds consumes massive egress bandwidth. Computing a diff against the client's last known state ensures only changing orders are transmitted over the WebSocket.
Technical Requirements
immeror manual patching.Acceptance Criteria