Python websocket depth subscription keeps closing

Hi all,

I’m currently subscribing to the depth@100ms, @trade and @ticker on the current symbols:
BTCBUSD, BTCUSDT, BTCUSDC, BUSDUSDT, USDCBUSD, ETHBUSD, ETHUSDT

The programs runs fine on my PC, however, when running on an AWS EC2 server, it disconnects frequently (roughly every 10-15mins) with the exception:

File “websockets/protocol.py”, line 439, in aiter
File “websockets/protocol.py”, line 509, in recv
File “websockets/protocol.py”, line 812, in ensure_open
websockets.exceptions.ConnectionClosedError: code = 1006 (connection closed abnormally [internal]), no reason

My program is in python and uses one socket for all the above mentioned symbols.
I’m running python3.7 and websockets8.1

Has anyone encountered this issue ?

Thanks in advance

Hello, this is hard to troubleshoot since we don’t know have access to your code neither your unique set up environment, but it seems to be a local issue.
Does the Rest API requests work on your AWS EC2? Try to design multiple test cases to exclude possible reasons out until you find more relevant information.