Skip to main content

WebSockets overview

QuantDesk’s backend exposes real-time updates via Socket.IO on the same HTTP server as the REST API (default local gateway http://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

  1. Reuse one connection per session where possible; avoid reconnect storms.
  2. Backoff on disconnect — exponential delay with a sane maximum (for example 1s → 32s cap).
  3. Do not treat WS as source of ledger truth — reconcile critical state via REST or your canonical persistence path.
  4. 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 /health before debugging sockets.
  • Watch browser devtools → WS frames when iterating from the frontend.