Skip to content

WebSocket Reconnect Behavior

This playbook explains how fyers-store reconnects to market and order WebSockets.

What Happened

  • WS disconnects or errors appear in the logs.
  • Data feed stalls (no new messages).

Why It Happens

  • Network blips, FYERS maintenance, or auth invalidation.
  • SDK-level reconnect limitations or throttling.

What To Check

  • logs/fyers_ws_errors.log for disconnect reasons.
  • config/fyers_ws.yaml reconnect and backoff settings.
  • store.health_check() for market_ws and order_ws status.

What To Do Next

  1. Confirm the token is valid (run fyers-auth if unsure).
  2. Restart the process if reconnect attempts are exhausted.
  3. Ensure subscriptions are re-applied after reconnect.

Safety Notes

  • Reconnect backoff prevents reconnect storms that can trigger rate limits.
  • Order WS reconnect triggers a REST reconcile before new messages are consumed.

Scenario Example

Scenario: WS reconnects repeatedly every few seconds. What happened: - The adapter is reconnecting with backoff but auth is invalid. What to check: - Auth error logs and token timestamp. What to do next: - Refresh the token, restart the process, and confirm stable connectivity.