-
Notifications
You must be signed in to change notification settings - Fork 134
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: "cannot decode". Error validating utf8 #224
Comments
Forked and made changes described above. Currently testing. If everything's gonna be ok - i will make a PR. |
I don't think there should be an escape sequence in there, it's just a UUID and should be alphanumeric with hyphens. This makes me wonder if the |
You're right. The issue is not the Here are some examples:
Since we don't have options to check the integrity of the message(for example, through check sum), the only thing we can do - ignore broken messages. But. also, we don't have a universal way to check whether the message is broken or not(for cases like message with topic we didn't subscribe to). The only thing we can do - ignore the exceptions, and keep the connection open. This is what i did. I added an argument I pushed all the changes to my fork, and gonna make a PR with details what i did, and why. |
I'll do it tomorrow |
I'm not sure how to reproduce this issue, do you think there's a good way to do it for testing purposes? |
What do you want to reproduce? A broken message from websocket? What is the ultimate goal in reproducing the issue? You can see the logs, that i attached, all you'll get after reproducing the issue - exactly the same logs, and the same result - |
I've never had this issue myself and never seen it reported, so I'd like to be able to test the fix before committing to master. I have used pybit to run tests for days at a time but have never seen this problem. So I just want to be able to reproduce it before approving the PR. |
This PR, actually, is not a fix. It just provides a way to handle the error in So changes are backward compatible, because by default the behaviour in the PR is completely the same as in current version. If you want to test the behaviour when a broken message is received from websocket, you can, for example, override/mock/change the |
My websocket connection is constantly being cut off.
I turned on debug pybit and websocket logs to see what's wrong.
Here is what i've got:
I took a look inside
websocket
package. The exception is thrown fromwebsocket._abnf.py.continuous_frame.extract()
method.So, there could be several reasons why the exception is thrown:
Disclaimer: i know that
if
statement is executed until firstTrue
, but, since i'm not familiar with implementation details of thewebsocket
package, i started with the part that i can figure out - utf8 validation:As we can see, the validation fails because of the
\x
escape sequence.What can we do with it?
skip_utf8_validation=True
toWebSocketApp.run_forever()
method should solve the issueP.S. I'm using the lates pybit version - 5.7.0
The text was updated successfully, but these errors were encountered: