Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    SmartWebSocketV2 reconnect only returns one ticker data after disconnect — all other tickers stop updating

    General Discussion
    1
    1
    7
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      Ekraj last edited by

      Hi all,

      I’m using SmartAPI’s SmartWebSocketV2 to stream multiple NSE tickers and generate live signals using Order Book Imbalance (OBI) and Volume Imbalance.

      Problem:

      Initially, the WebSocket streams all tickers correctly.

      After some time, I see repeated disconnects and reconnects:
      example :

      AXISBANK — Buy (Score: 0.606, Spread: 10.0, Mid: 106605.0)
      📈 DIVISLAB — Sell (Score: -0.9288, Spread: 50.0, Mid: 610025.0)
      📈 ADANIENT — Sell (Score: -0.923, Spread: 30.0, Mid: 227935.0)
      📈 LT — Sell (Score: -0.7807, Spread: 10.0, Mid: 369395.0)
      📈 HINDALCO — Hold (Score: -0.0862, Spread: 35.0, Mid: 70022.5)
      📈 ADANIPORTS — Buy (Score: 0.4086, Spread: 10.0, Mid: 131865.0)
      📈 JSWSTEEL — Hold (Score: -0.1565, Spread: 30.0, Mid: 105385.0)

      [W 250813 15:26:19 smartWebSocketV2:318] Attempting to resubscribe/reconnect (Attempt 1)...

      🔌 WebSocket Connected
      📈 BAJAJFINSV — Hold (Score: 0.054, Spread: 20.0, Mid: 191420.0)
      [W 250813 15:26:25 smartWebSocketV2:318]
      Attempting to
      resubscribe/reconnect (Attempt 2)...
      🔌 WebSocket Connected
      📈 BAJAJFINSV — Sell (Score: -0.4743, Spread: 20.0, Mid: 191420.0).

      current subscription logic:

      self.ws = SmartWebSocketV2(jwt_token, API_KEY, CLIENT_CODE, feed_token)
      self.ws.on_open = self.on_open
      self.ws.on_data = self.on_data
      self.ws.on_error = self.on_error

      def on_open(self, ws):
      print("✅ WebSocket connected")
      self.ws.subscribe("stream_1", 3, [{"exchangeType": 1, "tokens": tokens}])

      i tried everything but it dosent fixed.
      is there anything im missing or bug im not abel to catch.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post