# Receive real-time order updates **SUBSCRIBE /orders** Real-time order updates stream with resume capability. Query Parameters: - since=<uint64> Last applied seq for resume (optional; must be >0; absent or 0 → start from live tail) - market=<id> Repeatable; filter by market_id - account_id=<id> Repeatable; filter by account_id Resume Semantics: 1. Client connects with since=S (last applied seq) 2. Server replays frames with seq >= S in order 3. Sends backlog_end (last_seq = current max) 4. Continues live streaming If S > current max → immediate live (no backlog) If S too old (retention gap) → error frame (code=resume_too_old) then close (4009) Idempotency / Ordering: - seq strictly monotonic per broker; no gaps (gap ⇒ operational incident) - Client drops any frame with seq <= last_applied_seq - Expected next seq = last_applied_seq + 1 (else trigger reconnect + resume) Heartbeats: - Sent when no order_update within configured interval - Heartbeat does NOT advance seq; only order_update frames advance seq - Heartbeat and backlog_end both repeat the last data seq Flow Control: - Server may enforce max_pending_frames/bytes and close with code 4008 (flow_control) Close Codes: 1000 normal 1001 going_away 1011 internal_error 4008 flow_control 4009 resume_too_old / protocol_version 4401 unauthorized ## Messages ### Order Update Frame Order state change notification #### Payload - **type** (string) - **seq** (integer(int64)) - **ts_ns** (integer(int64)) - **payload** (object) Current state of an order. ### Order Reject Frame Notification of a rejected order command (Amend/Cancel) #### Payload - **type** (string) - **seq** (integer(int64)) - **ts_ns** (integer(int64)) - **payload** (object) ### Heartbeat Frame Keep-alive heartbeat (does not advance seq) #### Payload - **type** (string) - **seq** (integer(int64)) Repeats last delivered data seq; heartbeat does not advance global seq - **ts_ns** (integer(int64)) - **payload** (object) ### Backlog End Marker Signals end of historical replay; live streaming begins #### Payload - **type** (string) - **seq** (integer(int64)) - **ts_ns** (integer(int64)) - **payload** (object) ### Error Frame Error notification before close #### Payload - **type** (string) - **seq** (integer(int64)) - **ts_ns** (integer(int64)) - **payload** (object) ## Bindings #### Operation WebSockets-specific information - **headers** (object) - **query** (object)