Connection to remote host was lost

I have a script which trades based on Live Data for hours and days. However, I receive this error from websocket suggesting “Connection to remote host was lost”.

I have observed this for more than a month now. I have handled the error such that my program reconnects and tries to continue trading. However, is there a set of well known reasons why the connection should drop like this?

Thanks in advance!

Hello, I am also receiving the same error. Can you please provide the source code for the reconnection?

1 Like

I am using python websocketApp for this purpose.

I first catch the error with on_error. Then set a new instance of websocketApp and connect again.

Nothing fancy.

self.ws=websocket.WebSocketApp(websocketURL,
on_message = self.on_message,
on_error = self.on_error)

Let me know if you need more help.