WS ping-pong does not prevet the user stream from stopping

Hello I have strange problem and I would like to ask for help. I use python-connector, I have websocket for orders. In debug, I can see normal messages “Recived ping” - “Responded pong”. Yet order status messages sometimes stop coming.
I do not know why is that, but I would like to implement my own way to check the server connection, so I send ping and check for pong from server.
Is that possible, are there any examples how to do it?
is the solution to send every 30min client.renew_listen_key(response["listenKey"])

After testing, that seems to be the solution. Renew listen key every 30 min.

The listenkey can expire unless you send a keep alive before 60 minutes have passed. The binance connector for nodejs sends the listen key keep alive every 50 minutes, which has been working well: