How can I close the websocket manually? I have a script in which after the market hours , I wish to close the websocket. Can on_close() be called manually?
Thanks Srijan. the first link suggest that stop() should be used in on_close(). What are the affects if I use it outside on_close() ?? How does it really differ from close()
You can call stop method to stop websocket connection, as per your requirement outside of on_close as well. close event is called when websocket closes due to any reason, if on_close method callback is assigned.
https://kite.trade/docs/pykiteconnect/v3/#kiteconnect.KiteTicker.stop
https://kite.trade/docs/pykiteconnect/v3/#kiteconnect.KiteTicker.close
stop
method to stop websocket connection, as per your requirement outside of on_close as well.close
event is called when websocket closes due to any reason, ifon_close
method callback is assigned.