on reconnect feed goes crazy

raja1sttarde
Hi,

on my python websocket, i have the ticker file, to which i added;
def on_noreconnect(ws):
kws.close()
kite.connect(threaded=true)

kite.connect(threaded=true)
kws.on_noreconnect = on_noreconnect

i = get curr time in 'hi' format
while i<1530:
if lastTickTm >0 and time.time()-lastTickTm>10 and kws.is_connected()==false
print ('restarting ticker')
kws.close()
kite.connect(threaded=true)
lastTickTm = time.time()
i = get curr time in 'hi' format

my problem is when it does manage to resubscribe, it's on fire. it's almost like there is more than one instance of kws running, the number of tickes goes up exponentially.

how can i correctly re-connect?

Thanks for your help.
  • rakeshr
    @raja1sttarde
    kite.connect(threaded=true)
    We don't see, the assignment of kite in above code. You can refer to this code for threaded example.
  • raja1sttarde
    @rakeshr thanks for your reply.
    my ticks work fine. when they work, lol, z-feeds are super unstable . Yesterday it was Jio doesn't support cloudfare dns. there always seems to be some issue. i can't step away from the computer without the computer warning me of the feed disruption. So much so i actually started to look at leases lines and direct connect to NSE, but they are out of my budget. sigh.

    kws = KiteTicker(key, at)
    it's there. My problem is on reconnection my tick count is very high. at first i thought they are messages that were in transit that were coming in delayed. but that's not the case.

    since i am starting connect in threaded mode does that mean i need to call its process id to restart?

    i use python only for websocket, my knowledge of python is really limited.

    thanks for you help.
  • raja1sttarde
    if someone runs into this problem, the solution is using thread queue
Sign In or Register to comment.