ConnectionClosedOK with code 1001 (going away) is a normal close of the WebSocket, not a bug in your code. Binance explicitly states that a single WebSocket connection is only valid for 24 hours, so after running for a long time (days) you should expect the server to disconnect you and you must implement reconnection logic on the client side.