Is there a way to increase the timeout for websocket in python client. I am facing too many disconnects from last couple of days. Not sure why this happens.
I even tried using ws.reconnect on on_close method, but thats working. Its not reconnecting.
@sujith , looking at the forum, I feel kite API is half baked cake and charging a fee for this is not good at all. It's like people are paying for service and not getting it properly. Instead of this, why don't you give it as a free to users and perform beta testing?
@sujith@Kailash : I would agree with @ankur0101 on this. Also, since kite API is based on Python, at least python websocket client should have been a stable one and should have been the first one for new stable features like reconnect (based on tick). On the other hand it looks like python websocket client is the least stable and last to get feature updates. While I was going through other threads, people have reported that they have gotten 90+ disconnections throughout the day on python websocket client (i.e. one disconnection every 4 min). Also, all disconnections (at least in my case) are the ones where Zerodha server is closing/Terminating connection. Any specific reasons for this.
Would request your urgent attention on this - else, I am not sure how to go ahead with automated trading using Kite APIs when data sanctity is in question.
It's like clients are paying money as well as testing the KiteAPI for Zerodha. Why don't Zerodha does proper testing of the services and then start collecting the fee. On one hand Zerodha collecting money for API development from clients and also getting clients test their API. Not stable at all.
1) Should we just do a "pip install pykiteconnect" for this upgrade ? Or we need to clone/download it? 2) where should we put the line "kws.enable_reconnect(reconnect_interval=5, reconnect_tries=50)" in our code - just before calling ws.connect() ?
AttributeError: 'WebSocket' object has no attribute 'enable_reconnect'
Also, is there any issues today with socket. The socket keeps closing after few secs of connecting and now I am not even able to issue ws.reconnect() or kws.connect() in on_close() call back method.
@vivek@sujith : same issue. can you please use it at your end first and let us know.
AttributeError: 'WebSocket' object has no attribute 'enable_reconnect'
Issue seems to be as below: setup.py in the beta version doesn't seem to be configured properly. Build and setup seems to be broken. I did "python setup.py install" and still program is taking old "__init__.py".
It has at least started working now (since enable_reconnect method is present in the beta version of __init__.py). Need to see if auto-reconnect actually works.
@vivek@sujith : am using the beta version now (and running 3 websockets)
Following is the issue - first disconnection gets reconnected successfully. On second disconnection, no reconnection is made. Can you please check the code and see if all the disconnections are covered or only first.
@naz I ran it for the entire day and I could see it got disconnected few times and automatically picked up. A simple exercise to test is to run it and disconnect your wifi for few seconds and then connect it back.
@prakash.jj Maybe you are this in Ubuntu 14.04 or other Linux which has issues with OpenSSL. You can try sending disable_ssl_verification as True while connecting.
1. Uninstall current kiteconnect package or create a new virtualenv to test. (pip unininstall kiteconnect) 2. Install the new package from Github branch -
@vivek I am facing frequent disconnections. I am on Ubuntu 14.04 and using JavaConnect. Is there any parameter disable_ssl_verification=True for the Java wrapper?
In case, any other community member is also facing frequent disconnection issue, it might be good to check if you are doing heavy data processing/saving work inside on_tick() function. In my case, frequent disconnection was happening because heavy data processing/saving work (inside on_tick() ) was not getting completed before another on_tick() call back.
@sujith@vivek : thanks for your support and patience so far. Really appreciate you keeping up with all the queries of almost all the community members.
We are planning to release reconnection feature for pykiteconnect by the end of this week, it will resolve your issue.
On the other hand it looks like python websocket client is the least stable and last to get feature updates.
While I was going through other threads, people have reported that they have gotten 90+ disconnections throughout the day on python websocket client (i.e. one disconnection every 4 min). Also, all disconnections (at least in my case) are the ones where Zerodha server is closing/Terminating connection. Any specific reasons for this.
Would request your urgent attention on this - else, I am not sure how to go ahead with automated trading using Kite APIs when data sanctity is in question.
kws.enable_reconnect(reconnect_interval=5, reconnect_tries=50)
1) Should we just do a "pip install pykiteconnect" for this upgrade ? Or we need to clone/download it?
2) where should we put the line "kws.enable_reconnect(reconnect_interval=5, reconnect_tries=50)" in our code - just before calling ws.connect() ?
You will have to clone the repo and try it.
Check out usage information here.
AttributeError: 'WebSocket' object has no attribute 'enable_reconnect'
Also, is there any issues today with socket. The socket keeps closing after few secs of connecting and now I am not even able to issue ws.reconnect() or kws.connect() in on_close() call back method.
AttributeError: 'WebSocket' object has no attribute 'enable_reconnect'
Issue seems to be as below:
setup.py in the beta version doesn't seem to be configured properly.
Build and setup seems to be broken. I did "python setup.py install" and still program is taking old "__init__.py".
pip install directory where setup.py exists
now also, the socket is getting closed every second. and its reconnecting. there is really something wrong with the socket connection today.
I copied "__init_.py" and "exceptions.py" from the beta version package folder "C:\Users\xxxxx\Desktop\pykiteconnect-reconnection\kiteconnect"
to below folder and overwrote the old files.
"C:\ProgramData\Anaconda3\Lib\site-packages\kiteconnect"
It has at least started working now (since enable_reconnect method is present in the beta version of __init__.py). Need to see if auto-reconnect actually works.
Following is the issue - first disconnection gets reconnected successfully. On second disconnection, no reconnection is made.
Can you please check the code and see if all the disconnections are covered or only first.
@prakash.jj Maybe you are this in Ubuntu 14.04 or other Linux which has issues with OpenSSL. You can try sending
disable_ssl_verification
asTrue
while connecting.kws.connect(disable_ssl_verification=True)
1. Uninstall current
kiteconnect
package or create a new virtualenv to test. (pip unininstall kiteconnect
)2. Install the new package from Github branch -
Is there any parameter
disable_ssl_verification=True
for the Java wrapper?You can do it using NaiveSSLContext
It will just accept all certificates.
You will have to set this naive context to your websocket factory. Code looks like this,
@sujith @vivek : thanks for your support and patience so far. Really appreciate you keeping up with all the queries of almost all the community members.