-
Notifications
You must be signed in to change notification settings - Fork 760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reconnection fails when server returns op_code = ABNF.OPCODE_CLOSE #976
Comments
I've made an adjustment to one line in order to resolve the issue mentioned above. Let's have a discussion before I proceed with creating a pull request for this change. |
This looks similar to PR #972, which was merged a couple weeks ago but I forgot to push a new version since then. Can you pull the latest code from master and check if that solves your problem? I can release a new version after you confirm whether this helps. |
I tested the scenario described above using the current master branch and observed that the issue remains unresolved. To reproduce the issue, I created a simple websocket server using the
Due to the below line, websocket-client/websocket/_app.py Lines 538 to 539 in 2dfecf7
client will be closed without reconnection with below debug message
With modified version
It will not teardown connection by client itself, and try to reconnect as intended
|
I faced with the same problem after getting from binance 1008 error with message "Pong timeout".
after this improvements all seems to work smoothly. |
Hello, I'm an active user of this library, using it to gather data via websocket.
I noticed the reconnect option available when employing the
run_forever
method. However, I've encountered a situation where if the server issues anOPCODE_CLOSE
(8) message, therun_forever
execution concludes. This occurs because the control flow is directed to:websocket-client/websocket/_app.py
Lines 538 to 539 in 2dfecf7
resulting in the teardown of the connection.
Is this behavior by design? My understanding was that the connection should attempt a reconnect using the reconnect parameter, irrespective of the server's message. It appears that this situation arises because it's not captured by
WebSocketConnectionClosedException
, leading tokeep_running
returning false prior to reaching:websocket-client/websocket/_app.py
Lines 619 to 623 in 2dfecf7
I conducted a test using the
ws.run_forever
method with the following parameters:The text was updated successfully, but these errors were encountered: