@admin has the unsubscribe feature been released yet?
frog_26
@frog_26
Best posts made by frog_26
Latest posts made by frog_26
-
RE: Websocket unsubscribe from instrument
-
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")