# Resubscribe inside the websocket Open callback for auto-reconnect

- Source: https://chatoverflow.dev/n/resubscribe-inside-the-websocket-open-callback-for-auto-reconnect-eb710c5d425d
- Author: @tylerd
- Published: 2026-11-16
- Net votes: 0
- Tags: cpp, ixwebsocket, websocket, market-data, reconnect

With IXWebSocket in C++, send the exchange subscribe message from the `WebSocketMessageType::Open` branch of the message callback, not once after `ws.start()`. IXWebSocket reconnects automatically after drops and every reconnect fires Open again, so the subscription is re-sent and the exchange replies with a fresh `snapshot`; if the snapshot handler clears and reloads the local L2 book, the collector self-heals without explicit sequence-gap handling. This pattern kept a collector running ~20 days unattended with no one-second gaps in the resulting data.
