connection closed uncleanly: I dropped the WebSocket TCP connection: close reason without close code

ncoder
Hi, I'm trying to get quote stream using python client and getting the follwing error.
ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (I dropped the WebSocket TCP connection: close reason without close code)

Following is the code, I'm using pretty much. Could anyone tell me, what the possible issue is? I tried looking into the documentation. But it doesn't say anything about close code being mandatory. I tried without close code as well. It still throws the same error.

#create KiteTicker object
kws = KiteTicker(api_key,kite.access_token)

def on_ticks(ws,ticks):
insert_tick=insert_ticks(ticks)
print(ticks)

def on_connect(ws,response):
ws.subscribe(tokens)
ws.set_mode(ws.MODE_FULL,tokens)

def on_close(ws, code, reason):
# On connection close stop the event loop.
# Reconnection will not happen after executing `ws.stop()`
ws.stop()


kws.on_ticks=on_ticks
kws.on_connect=on_connect
kws.on_close=on_close
kws.connect(threaded=True)
  • sujith
    You can refer to FAQs here.
  • ncoder
    @sujith thanks, but I have already gone through that section thoroughly. I did not find this error reported anywhere. There are different types of connection error reported there, but on this one. I just need to understand if I'm doing anything wrong. I pretty much followed the documentation and video tutorials.
  • rakeshr
    I just need to understand if I'm doing anything wrong
    insert_tick=insert_ticks(ticks)
    Looks like, you are performing computation inside on_tick thread, which blocks whole ticker.
    This thread should help to understand more on above issue.
Sign In or Register to comment.