-
Notifications
You must be signed in to change notification settings - Fork 761
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
Websocket.close() meaning of "close status: XXXXX" #414
Comments
Or perhaps I can get a more verbose error message pointing me to the problem? |
status codes are in the websocket/_abnf.py file (or you could lookup RFC 6455). Are you receiving a valid status code number or part of the body of the next message received? This is the behavior that I am seeing and I think is a bug in the close implementation (_core.py). close() sends an OPCODE_CLOSE to the other end of the connection and then immediately reads a new frame and expects it to also be an OPCODE_CLOSE. This is not guaranteed and could be any other valid message (in my case, I get OPCODE_TEXT or OPCODE_PING). Ping has no payload so the recv_status line you posted throws an exception that is caught a few lines later and the close continues (no error message). If I get an OPCODE_TEXT, the recv_status line grabs the first 2 bytes of my text message and converts it to an invalid opcode (31496, etc), and then displays the error. |
Fix #414: proper handling of close method.
When I close a websocket object I get status codes printed to the console. They're raised as a result of a non-"STATUS_NORMAL" status:
Is there a dictionary somewhere on what each code means?
The text was updated successfully, but these errors were encountered: