Hi @Pushwinder, When the connection is off websocket error or disconnect is not called immediately. It may sometimes take more than a minute to trigger events. Our approach is based on the basic behavior of websockets. When the connection is on it will receive a heartbeat tick. Kite Connect client expects heartbeat tick every second. If it doesn't get tick even after user specified time interval then it will attempt to reconnect. We have added reconnection feature to pykiteconnect. Check out this thread to know how to integrate it.
Dear @sujith I tried kws.enable_reconnect with new version of kiteconnect, it is giving error AttributeError: 'WebSocket' object has no attribute 'enable_reconnect'
@Pushwinder I guess you are still using the current production Kiteconnect but auto reconnection feature is in feature branch. You can do this
1. Uninstall current kiteconnect package or create a new virtualenv to test. (pip unininstall kiteconnect) 2. Install the new package from Github branch -
Yeah, i tried the same, but enable_reconnect is not showing in its list of attributes, Does "kws.reconnect" serve the same purpose??? Default values are reconnect_interval=5, reconnect_tries=300
When the connection is off websocket error or disconnect is not called immediately. It may sometimes take more than a minute to trigger events. Our approach is based on the basic behavior of websockets. When the connection is on it will receive a heartbeat tick. Kite Connect client expects heartbeat tick every second. If it doesn't get tick even after user specified time interval then it will attempt to reconnect.
We have added reconnection feature to pykiteconnect. Check out this thread to know how to integrate it.
AttributeError: 'WebSocket' object has no attribute 'enable_reconnect'
Example for reconnect looks like this
kws.enable_reconnect(reconnect_interval=5, reconnect_tries=50)
1. Uninstall current kiteconnect package or create a new virtualenv to test. (
pip unininstall kiteconnect
)2. Install the new package from Github branch -
Does "kws.reconnect" serve the same purpose???
Default values are
reconnect_interval=5,
reconnect_tries=300
Yes. This method call will set a time interval, after which pykiteconnect has to try reconnection and number of times it can retry.
kws.enable_reconnect(reconnect_interval=5, reconnect_tries=50)
had to copy the entire __init__ from https://github.com/rainmattertech/pykiteconnect/blob/reconnection/kiteconnect/__init__.py
Thanks for your support