Im getting error in websocket


  • Im using the same code for websocket as in the example -

    ## WebSocket
    from smartapi import WebSocket 
    FEED_TOKEN= "your feed token"
    CLIENT_CODE="your client Id"
    token="channel you want the information of" #"nse_cm|2885&nse_cm|1594&nse_cm|11536"
    task="task" #"mw"|"sfi"|"dp"
    ss = WebSocket(FEED_TOKEN, CLIENT_CODE)
    
    def on_tick(ws, tick):
        print("Ticks: {}".format(tick))
    
    def on_connect(ws, response):
        ws.websocket_connection() # Websocket connection  
        ws.send_request(token,task) 
        
    def on_close(ws, code, reason):
        ws.stop()
    
    # Assign the callbacks.
    ss.on_ticks = on_tick
    ss.on_connect = on_connect
    ss.on_close = on_close
    
    ss.connect( )
    

    But I get error like -

    07-04-2021 20:16:01 -DEBUG-Connection error: 1006 - connection was closed uncleanly (I dropped the WebSocket TCP connection: 'WebSocket' object has no attribute 'websocket_connection')
    07-04-2021 20:16:01 -DEBUG-Connection closed: 1006 - connection was closed uncleanly (I dropped the WebSocket TCP connection: 'WebSocket' object has no attribute 'websocket_connection')
    

    Please fix it.


  • Hi @keer2405 we have noted your issue and reported to the team we will update you on this.