WebSocket 2.0 Streaming is not Receiving the Live Price Feed


  • @Vignesha @Ashok Not working
    tried today with the same code but still gives me the HeartBeat Sending Failed Not sure how it is working for everyone else... if something has changed that im not aware of? But im getting ltp and my holdings and things like that

    2023-06-12 07:13:48.017326 : Start task in the background
    {'task': 'hb', 'channel': '', 'token': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6IkExMjAyNDY5IiwiaWF0IjoxNjg2NTUyMzQ4LCJleHAiOjE2ODY2Mzg3NDh9.hjMewZOkbEL3zOmXWX_Gd1VF0CidQmRayeXhqRaMf8IcViFxy9sdfXcsJTWRWHxdEuAo3r1hbpz_WpP_aMCivQ', 'user': 'A1202469', 'acctid': '<myaccountid>'}
    HeartBeat Sending Failed
    __on_open################
    {'task': 'cn', 'channel': 'NONLM', 'token': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6IkExMjAyNDY5IiwiaWF0IjoxNjg2NTUyMzQ4LCJleHAiOjE2ODY2Mzg3NDh9.hjMewZOkbEL3zOmXWX_Gd1VF0CidQmRayeXhqRaMf8IcViFxy9sdfXcsJTWRWHxdEuAo3r1hbpz_WpP_aMCivQ', 'user': 'A1202469', 'acctid': '<myaccountid>'}
    2023-06-12 07:13:49.514800 : Start task in the background
    on open{'task': 'hb', 'channel': '', 'token': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6IkExMjAyNDY5IiwiaWF0IjoxNjg2NTUyMzQ4LCJleHAiOjE2ODY2Mzg3NDh9.hjMewZOkbEL3zOmXWX_Gd1VF0CidQmRayeXhqRaMf8IcViFxy9sdfXcsJTWRWHxdEuAo3r1hbpz_WpP_aMCivQ', 'user': 'A1202469', 'acctid': '<myaccountid>'}
    
    2023-06-12 07:13:49.884945 : Start task in the background
    {'task': 'hb', 'channel': '', 'token': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6IkExMjAyNDY5IiwiaWF0IjoxNjg2NTUyMzQ4LCJleHAiOjE2ODY2Mzg3NDh9.hjMewZOkbEL3zOmXWX_Gd1VF0CidQmRayeXhqRaMf8IcViFxy9sdfXcsJTWRWHxdEuAo3r1hbpz_WpP_aMCivQ', 'user': 'A1202469', 'acctid': '<myaccountid>'}
    HeartBeat Sending Failed
    

  • @Ashok Thanks for the reply yes I have issue with getting live data from smartapi. I even can get historical data, ltp but i just cant get live data from it... It would be great if you cold help.
    This is my code

    from cred import username, apikey, pwd
    from smartapi import SmartConnect
    from smartapi import SmartWebSocket
    import pandas as pd
    import pyotp
    import time
    
    <Authentication part>
    
    token = "nse_cm|2885"
    
    task = "mw"  
    
    ss = SmartWebSocket(feedToken, username)
    
    def on_message(ws, message):
        print("Ticks: {}".format(message))
    
    def on_open(ws):
        print("on open")
        ss.subscribe(task, token)
    
    
    def on_error(ws, error):
        print(error)
    
    
    def on_close(ws):
        print("Close")
    
    # Assign the callbacks.
    ss._on_open = on_open
    ss._on_message = on_message
    ss._on_error = on_error
    ss._on_close = on_close
    
    ss.connect()
    

    Since today is sunday cant test this will try it tomorrow and let you know if it has started to work...

    Can you please let me know if my code is right and also out of this topic - is there a way to stock fetching the live data? previous when it worked i had to interpret the code for this to stop fetching the data


  • @anil_patel @Vignesha PM me. WS 2.0 is indeed working fine. Let me know any help is required.


  • I have this issue but seems no one is talking about it not really sure whats happening with the smart api @admin can this be addressed? Github example is not working at all if there is any issue let us know so we can wait


  • @admin I'm facing the same issue on 18 May. No information in Ticks, just heartbeat messages.


  • No tick data


  • @anil_patel
    Are you able to receive the live feed using websocket 2.9?


  • @anil_patel Facing same issue


  • @anil_patel Facing the same issue..


  • @anil_patel me too