WebSockets overview
QuantDesk’s backend exposes real-time updates via Socket.IO on the same HTTP server as the REST API (default local gatewayhttp://localhost:3002 unless your deployment differs).
Conceptual model
- The server pushes structured payloads for market, order, position, and related updates where enabled.
- Clients typically connect from the web app with the Socket.IO client; programmatic clients should mirror that handshake pattern.
Connection hygiene
- Reuse one connection per session where possible; avoid reconnect storms.
- Backoff on disconnect — exponential delay with a sane maximum (for example 1s → 32s cap).
- Do not treat WS as source of ledger truth — reconcile critical state via REST or your canonical persistence path.
- Authentication — user-scoped channels may require an authenticated session or token from your login flow; confirm against Swagger and implementation.
Relationship to HTTP API
- Prefer REST/Swagger for commands (place/cancel) unless an endpoint explicitly documents WS usage.
- Use sockets for streaming state and UI freshness.
Debugging locally
- Confirm REST
/healthbefore debugging sockets. - Watch browser devtools → WS frames when iterating from the frontend.