Since yesterday, websocket is timing out once in a while during trading hours. Even when I start the websocket client at about 09:10:00 hrs, it takes 3-4 restarts before it starts receiving data. This has been happening for last 2-3 days.
I am using V2 APIs for websocket.
My timeout is set to 15 seconds. If no update is recieved in 15 seconds, the websocket client auto restarts.
I have subscribed to Nifty_50 in full mode and options ±500 from spot in ltpc mode:
# Data to be sent over the WebSocket. This is the subscription request.
data = {
"guid": str(uuid.uuid4()),
"method": "sub",
"data": {
"mode": "full",
"instrumentKeys": [NIFTY_50_INST_KEY]
}
}
data_ltpc = {
"guid": str(uuid.uuid4()),
"method": "sub",
"data": {
"mode": "ltpc",
"instrumentKeys": instrument_keys
}
}
My app is deployed in AWS (ap-south-1b, Mumbai), EC2 instance. So, network quality is top notch.
Got kicked out of my trade as the option price reported was about 18-19% below ltp Seeing this the first time.
I can share logs if required.
Also, between 11:02 and 12:11, the timeout has occurred 11 times in ws client:-
amit@bangalore:~/dissect$ grep 'Websocket communication error' chitragupt_2025-06-27.log
2025-06-27 11:02:36.170 - core.websocket_client - INFO - Websocket communication error. Will wait before retry:
2025-06-27 11:03:02.706 - core.websocket_client - INFO - Websocket communication error. Will wait before retry:
2025-06-27 11:03:29.256 - core.websocket_client - INFO - Websocket communication error. Will wait before retry:
2025-06-27 11:03:55.805 - core.websocket_client - INFO - Websocket communication error. Will wait before retry:
2025-06-27 11:52:56.927 - core.websocket_client - INFO - Websocket communication error. Will wait before retry:
2025-06-27 11:53:23.556 - core.websocket_client - INFO - Websocket communication error. Will wait before retry:
2025-06-27 11:53:50.114 - core.websocket_client - INFO - Websocket communication error. Will wait before retry:
2025-06-27 11:54:16.679 - core.websocket_client - INFO - Websocket communication error. Will wait before retry:
2025-06-27 11:54:47.169 - core.websocket_client - INFO - Websocket communication error. Will wait before retry:
2025-06-27 12:10:33.640 - core.websocket_client - INFO - Websocket communication error. Will wait before retry: sent 1011 (internal error) keepalive ping timeout; no close frame received
2025-06-27 12:11:00.227 - core.websocket_client - INFO - Websocket communication error. Will wait before retry:
Actual update received. Look at the timestamp ltt (Thursday, June 26, 2025 3:29:59.892 PM). Did it serve it from cache?
V2 WebSocket is deprecated and will soon be out of support. Please switch to the V3 WebSocket.
We have also recently observed some issues with V2 data streaming, including client disconnections.
We highly recommend migrating to V3 as soon as possible.
For more information, please refer to this announcement:
Hi @MohitGolecha@Pradeep_Jaiswar
I upgraded to websocket v3 in production on 2025-07-08. Since then, I have not seen a single timeout. And this includes the 2025-07-10 expiry