Managing Subscriptions to Real-Time Stock Updates in WebSockets

How can I stop receiving real-time updates for certain stock symbols?

If you're receiving real-time market data for stock symbols you no longer need, FYERS makes it easy to unsubscribe from them through the Market Data WebSocket API. This ensures your application stays efficient and avoids unnecessary bandwidth or data processing.

How to unsubscribe from real-time stock updates

  • Ensure WebSocket connection is active
    Your application must maintain an open connection to the FYERS Market Data WebSocket.
  • Send an unsubscribe message
    Use the following message format:
    {
      "symbol": ["NSE:RELIANCE-EQ", "NSE:TCS-EQ"],
      "type": "unsubscribe"
    }
    Replace the symbols with the ones you want to stop tracking.
  • Confirm unsubscription
    FYERS will send an acknowledgment message. Ensure your application handles this response correctly.
  • Update your internal tracking
    Remove the unsubscribed symbols from your app's local subscription list or UI, if applicable.

What if...

ScenarioOutcome
You send an unsubscribe request for a symbol you didn’t subscribe toThe server ignores it without error—safe to send
You still receive data after unsubscribingEnsure the symbol format is correct and the connection didn’t reset
You want to stop all real-time updatesEither close the WebSocket or send an unsubscribe for all active symbols
Always keep your symbol list updated. Unsubscribing from unused tickers improves app performance and reduces potential rate limit issues.
Sending too many subscribe/unsubscribe requests in quick succession may result in throttling or temporary disconnection. Use debouncing or batching where possible.

Last updated: 30 Jun 2025