I use Binance python, after times this error occures.
2021-06-15 22:27:18,993 - ERROR - ping/pong timed out
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\Projects\venv\lib\site-packages\websocket\_app.py", line 362, in run_forever
dispatcher.read(self.sock.sock, read, check)
File "C:\Users\Administrator\Desktop\Projects\venv\lib\site-packages\websocket\_app.py", line 74, in read
check_callback()
File "C:\Users\Administrator\Desktop\Projects\venv\lib\site-packages\websocket\_app.py", line 359, in check
raise WebSocketTimeoutException("ping/pong timed out")
websocket._exceptions.WebSocketTimeoutException: ping/pong timed out
for websocket I use this code:
def make_connection():
websocket.setdefaulttimeout(2)
try:
ws = websocket.WebSocketApp(consts.SOCKET_URL,
on_open=on_open,
on_message=on_message,
on_error=on_error,
on_close=on_close)
ws.run_forever(ping_interval=30, ping_timeout=15)
except Exception as e:
consts.hogger.exception(e)
if name == “main”:
make_connection()