Websocket connection lost too many times
Hello,
I developed a binary bot to schedule some trades at specific times during the day, but every day when I check the bot logs I found out that about 10% of the trades failed to execute on binary.com
After analyzing I figure out that the problem is because the WebSocket connection was "PREMATURELY CLOSED" with code 1001 - going away.
Sometimes I got the message "Unexpected end of stream" and other times it's "CloudFlare WebSocket proxy restarting".
My bot sends a heartbeat ping message every 10 seconds.
Does anyone here experienced this situation and know how to deal with that?
Thanks for the help!
Tagged:
Comments
Hi, Websocket connections can be expected to be interrupted several times a day as upgrades are performed and network issues anywhere between your client and our servers occur. Any system that you want to maintain long term connections needs to be able to automatically reconnect should the websocket connection close.