Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs
    1. Home
    2. frog_26
    3. Posts
    F
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by frog_26

    • RE: Websocket unsubscribe from instrument

      @admin has the unsubscribe feature been released yet?

      posted in Bugs
      F
      frog_26
    • Websocket unsubscribe from instrument

      I am able to subscribe and even send an additional instrument to be added to my subscription list. As in the example below, I first start streaming for 26000 data and after 5s, even 26009 data is sent along with 26000 data.

      token = "nse_cm|26000"
      ss.connect(threaded=True)
      time.sleep(5)
      token="nse_cm|26009
      ss.send_request(token, "mw")

      However, I want to unsubscribe from 26000 and I'm not able to do that. The docs say (https://smartapi.angelbroking.com/docs/WebSocket) that a blank string has to be sent to unsubscribe. I tried this piece of code but I still end up getting data for both instruments. What should I do to stop getting 26000 data and only get 26009 after a certain time? I cannot kill the script and restart, this has to be done within the code.

      token = "nse_cm|26000"
      ss.connect(threaded=True)
      time.sleep(5)
      ss.send_request("", "mw")
      token="nse_cm|26009
      ss.send_request(token, "mw")

      posted in Bugs
      F
      frog_26