Feed breaks off
The websocket thread finishes without blocking when there is no feed for few seconds. The logic should be modified to keep the thread open till market is open or explicitly unsubscribed for.
That's true. It does get disconnected.
To address that we've written a code to re-connect.
You could do that too till the time they can implement it at their end
Hmm - I think the issue is that you cannot let the API decide on blocking. I am using the non-blocking code
u.start_websocket(True) condition = threading.Condition() condition.acquire() condition.wait()
This works fine.
Spoke too soon. This thing is just not reliable. This is a disaster release.
So here is the workarround.
Schedule the program to run every 1 min
In the first line do
from tendo import singleton me = singleton.SingleInstance()
This will ensure that if the current instance dies it will restart it or else it will kill itself.
The feed shouldn't break off. Can you please use the sample python program here: https://gist.github.com/svishi/ba0ee4e08f1e2364addfe76c5b2ef7d7
and run it all day? Let us know the results
Have used it and tested it for several hours and the feed works.
@shrini-viswanath : It breaks off very often. Happened today as well. Internet cannot be an issue as it runs on a VPS. My websocket stopped at 10:01 today and I stopped getting data feeds.
Basically - the websocket becomes quite. No feeds are pushed. Can you please check if there is any code to check if data was pushed to all subscriptions or not ?
@abbanerjee Will do. Thanks for providing details
@shrini-viswanath : The websocket is not reliable and feeds stopped today a lot. I would say more often than usual. Its absolutely crititical to rely on feeds. Please do something.
By architecture you cannot do handshake on data broadcast, but form your end, you can atleast check if the last push to each open websocket was after the last feed recieved. I dont know if you can perform this check within two feed ticks, but its necessary to ensure that once subscribed - unless explicitly unsubscribed, you keep pushing data to a websocket. Even if the connection is lost from the client end, the server must continue to push. In case you see a new incoming subscription for the same instrument for same api key, you need to replace the socket I guess - but dont know what you have coded.
@shrini-viswanath : The feed is breaking off.
2017-07-06 09:38:30+05:30 , BANKNIFTY17JULFUT , 23466.30
Is the last feed I got before it broke off for me. It has already happened 3 times since market open.
Broke off again. This is really frustrating.
2017-07-06 10:17:16+05:30 , BANKNIFTY17JULFUT , 23452.00
Hey @abbanerjee, We are working on this issue
Okay, please confirm once you think you have fixed it so that we can test it.