Main loop is getting executed only once.

Dileep
Hi ,
I am using the below code. Here "on_ticks" loop is executing only once . After that my connection is getting closing.
Can any one please let me know what is wrong in the code.?

def on_ticks(ws,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 main loop
# Reconnection will not happen after executing `ws.stop()`
ws.stop()

# Assign the callbacks.
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.on_close = on_close
kws.connect()
  • rakeshr
    @Dileep
    You need to remove ws.stop(), as it gets called at end of each execution and closes the connection.
Sign In or Register to comment.