Python SDK: Data Websocket on AWS

Hi Team,

I receive the following messages in fyersDataSocket.log. Can you please share a fix or workaround to stop these messages? Sometimes the Websocket thread gets stuck after these messages

{"level":"ERROR","location":"[<lambda>:1666] data_ws","message":"[Errno 104] Connection reset by peer","timestamp":"2025-12-15 09:44:03,167+0530","service":"FyersDataSocket"}

{"level":"ERROR","location":"[<lambda>:1666] data_ws","message":"[Errno 104] Connection reset by peer","timestamp":"2025-12-15 09:46:25,755+0530","service":"FyersDataSocket"}

{"level":"ERROR","location":"[<lambda>:1666] data_ws","message":"[Errno 104] Connection reset by peer","timestamp":"2025-12-15 09:55:35,578+0530","service":"FyersDataSocket"}

{"level":"ERROR","location":"[<lambda>:1666] data_ws","message":"[Errno 104] Connection reset by peer","timestamp":"2025-12-15 14:02:29,544+0530","service":"FyersDataSocket"}

Hi ** **@naresh_janagam
Can you please check on this

Hi @deeeepak-bql

Regret for the inconvenience, let me get this checked

Hi @deeeepak-bql,

Thank you for your patience. We are in touch and need the logs to debug this issue.

I am also getting the same error,I’m trying to build 5 mins candle from the web socket data for my strategy in AWS EC2

Logs shared below

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“Connection to remote host was lost.”,“timestamp”:“2025-12-16 08:00:40,832+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[SSL: BAD_LENGTH] bad length (_ssl.c:2501)”,“timestamp”:“2025-12-16 09:03:56,869+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“Connection to remote host was lost.”,“timestamp”:“2025-12-18 07:25:10,429+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[Errno 32] Broken pipe”,“timestamp”:“2025-12-18 07:26:30,195+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[SSL: BAD_LENGTH] bad length (_ssl.c:2501)”,“timestamp”:“2025-12-18 07:35:18,592+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[SSL: BAD_LENGTH] bad length (_ssl.c:2501)”,“timestamp”:“2025-12-19 06:38:33,688+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[SSL: BAD_LENGTH] bad length (_ssl.c:2501)”,“timestamp”:“2025-12-19 06:40:09,768+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[Errno 32] Broken pipe”,“timestamp”:“2025-12-19 06:41:32,459+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[SSL: BAD_LENGTH] bad length (_ssl.c:2501)”,“timestamp”:“2025-12-19 06:43:15,055+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“Connection to remote host was lost.”,“timestamp”:“2025-12-19 06:45:38,985+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[SSL: BAD_LENGTH] bad length (_ssl.c:2501)”,“timestamp”:“2025-12-19 06:56:42,508+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[SSL: BAD_LENGTH] bad length (_ssl.c:2501)”,“timestamp”:“2025-12-19 07:05:01,116+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[SSL: BAD_LENGTH] bad length (_ssl.c:2501)”,“timestamp”:“2025-12-19 07:08:06,817+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[Errno 32] Broken pipe”,“timestamp”:“2025-12-19 07:09:41,175+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[Errno 32] Broken pipe”,“timestamp”:“2025-12-19 07:10:58,433+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“Connection to remote host was lost.”,“timestamp”:“2025-12-19 07:24:53,562+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[SSL: BAD_LENGTH] bad length (_ssl.c:2501)”,“timestamp”:“2025-12-19 07:45:11,727+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[SSL: BAD_LENGTH] bad length (_ssl.c:2501)”,“timestamp”:“2025-12-19 08:05:27,920+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[SSL: BAD_LENGTH] bad length (_ssl.c:2501)”,“timestamp”:“2025-12-19 08:39:11,625+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[Errno 32] Broken pipe”,“timestamp”:“2025-12-19 08:40:27,875+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[SSL: BAD_LENGTH] bad length (_ssl.c:2501)”,“timestamp”:“2025-12-19 08:47:37,588+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[Errno 32] Broken pipe”,“timestamp”:“2025-12-19 08:49:03,431+0000”,“service”:“FyersDataSocket”}

{“level”:“ERROR”,“location”:“[:1663] data_ws”,“message”:“[SSL: BAD_LENGTH] bad length (_ssl.c:2501)”,“timestamp”:“2025-12-19 08:59:29,073+0000”,“service”:“FyersDataSocket”}

Due to this, my calculations are going wrong. Kindly do the needful

Hi @7xNXBgI9BQ

Sorry for the inconvenience.

After a disconnection (which can happen for various reasons), the system should auto-connect. Could you please confirm whether it is auto-connecting or not?

We checked with @deeeepak-bql , and he confirmed that it’s not breaking and is auto-connecting after the disconnection.

Thanks.

hi @naresh_janagama

Websocket is working fine till 9.53, after that socket is getting disconnected and unable to receive any live ticks

     last_traded_time             symbol  high_price  low_price  open_price     ltp  vol_traded_today

180048 2025-12-26 09:07:09 NSE:MANAPPURAM-EQ 316.1 316.10 316.1 316.10 45413.0

180049 2025-12-26 09:15:00 NSE:MANAPPURAM-EQ 317.5 316.10 316.1 317.35 54298.0

180050 2025-12-26 09:15:00 NSE:MANAPPURAM-EQ 317.5 316.10 316.1 317.35 54298.0

180051 2025-12-26 09:15:01 NSE:MANAPPURAM-EQ 317.9 316.10 316.1 317.40 62843.0

180052 2025-12-26 09:15:02 NSE:MANAPPURAM-EQ 318.0 316.10 316.1 316.35 100957.0

… … … … … … … …

181439 2025-12-26 09:53:25 NSE:MANAPPURAM-EQ 318.9 314.55 316.1 316.65 2098107.0

181440 2025-12-26 09:53:25 NSE:MANAPPURAM-EQ 318.9 314.55 316.1 316.55 2098107.0

181441 2025-12-26 09:53:25 NSE:MANAPPURAM-EQ 318.9 314.55 316.1 316.60 2098107.0

181442 2025-12-26 09:53:31 NSE:MANAPPURAM-EQ 318.9 314.55 316.1 316.60 2098270.0

181443 2025-12-26 09:53:31 NSE:MANAPPURAM-EQ 318.9 314.55 316.1 316.60 2098270.0

this is NSE:MANAPPURAM-EQ tick on 26.12.2025, it stopped after 9.53

My architecture in AWS:

  • At 9.15, Tick data is automatically triggered using Eventbridge and it will run automatically and store data is S3
  • On data load in S3, OHLC for 5 min candle is calculated

After 9.53 entire strategy is halted.

Note: All security groups are configured to allow traffic from EC2

Logs in EC2:

2025-12-26 03:43:56,916-INFO-Websocket connected

2025-12-26 03:51:48,965-ERROR-[SSL: BAD_LENGTH] bad length (_ssl.c:2501) - goodbye

2025-12-26 03:51:54,029-INFO-Websocket connected

2025-12-26 04:01:20,566-ERROR-[SSL: BAD_LENGTH] bad length (_ssl.c:2501) - goodbye

2025-12-26 04:01:25,624-INFO-Websocket connected

Hi Pavan,

Sorry for the inconvenience. To debug this further, we’ll need to connect with you. Could you please DM your client ID?

Hi @naresh_janagama My Client ID: FU0118

Hi,@naresh_janagama

any update regarding the web socket disconnecting issue.

I have already shared my client ID:FU0118

Today also data stopped at 9.57 AM

Hey @7xNXBgI9BQ,

Our team has spoken with you. We will review the logs and update you accordingly. Thank you for your patience.