WebSocket disconnects cause stale bot state
Connections recover but position and order state drift from reality, leading to unsafe decisions. Reliable reconnection, gap detection, and replay boundaries are needed to stabilize.
Common symptom variants
Primary playbook
Handle WebSocket disconnects in trading bots with automatic reconnection, message gap detection, and state recovery—without missing fills or duplicating orders.
Recommended resource
WebSocket manager template with automatic reconnection, gap detection, and state recovery for trading bots.
Related posts
Crash Recovery: Reconciliation Loops That Prevent Double Orders
Build crash-proof trading bots with reconciliation loops that detect and correct out-of-sync state on restart—preventing double orders and orphan positions.
Signature invalid but bot was working: why clock drift breaks auth suddenly
When bot gets signature invalid or 401 after working fine for hours: why clock drift breaks exchange auth suddenly, and the time calibration that prevents it.