When establishing a live market feed connection through DhanFeed, it keeps getting closed.
The websockets are failing with this Error: 1006.
I tried establishing multiple DhanFeed connections at once and only listening to one at a time, but all of my concurrent connections are dropping simultaneously.
Is there something which I am missing or need to do to keep the connection alive.
Would love any help, thanks !
Note that the time after which the websocket connection closes is generally between 10-20 minutes.
I am using dhanhq’s Node Library (API v1 implementation) - (Can shifting to v2 solve this issue?)
Maybe. I already asked to implement it in V2 by Dhan Team, but due to work I traveled out of country, so I could not complete it. Will update shortly once published. Meantime would you like to contribute, please create PR
Though while troubleshooting I suspect that this might possibly be due to packet loss on my network. Will try on better network conditions if this is still reproducible.
Are you facing the same issue and if yes, what is the generic time period after this is happening with you?
Hello @arshpanghal - I don’t think this is a packet loss issue. I suspected the same and moved to AWS but it’s the same problem. I’m facing this issue since I started using the live feed and it has not worked for me at all. It keeps disconnecting randomly…Traceback (most recent call last):
File “/home/ec2-user/.local/lib/python3.9/site-packages/websockets/legacy/protocol.py”, line 628, in send
await self.ensure_open()
File “/home/ec2-user/.local/lib/python3.9/site-packages/websockets/legacy/protocol.py”, line 938, in ensure_open
raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: sent 1011 (internal error) keepalive ping timeout; no close frame received
2024-10-29 09:52:26,012 - ERROR - Unexpected WebSocket closure: sent 1011 (internal error) keepalive ping timeout; no close frame received…Also tagging @Tradehull_Imran to suggest a resolution if possible.
Yes, we have already moved the library to V2 and minimise the issue of random websocket closure for maximum users. We are looking into further optimising this so as to ensure a more stable and reliable connection.
Hi @virender_singh
I think the dhan team is really not looking into the issue for some reason.
Even though they say that they’ve migrated to v2, the node lib is still under v1.0.6
and even though I volunteered for upgrading it to v2, no one actually catered it.
With deep agony, I think its best for all us to migrate to zerodha APIs at best.
With so much vision in the company’s foundations, really didn’t expect so cheap implementations, and I hope somehow someday, they will be able to overcome these challenges.