-
Notifications
You must be signed in to change notification settings - Fork 312
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
wsjson.Write write in a single frame always #315
Comments
Hi @dar7man Yea super weird looks perfect to me. Can you try the dev branch as well? Just |
Hi @nhooyr Thanks for quick response. I tried dev brach, but not luck. Still doesn't work. Scenario is the same:
Super weird. Reason is "Invalid request" but request is valid, so I'm guessing this is just some general error. |
Huh, yea that's really bizarre. Only difference between I see is the |
No, unfortunately. This number doesn't matter. Looks like something different must be sent using your package. I don't know, maybe packet sniffing/monitoring could help with investigation? I now that Windows 10 had build in such a tool (pktmon.exe). Maybe I'll try some day to use it and try to find a difference. |
Got some news here. Looks like getting rid of wsjson.Write() solves the problem.
I was suspecting that json Encoder my be doing something that Binance don't like, so I compared output for the same request from Marshal and from Encoder. Indeed there is a difference: Encoder is adding extra line feed and the end of buffer (ASCII: 10). So I send buffer prepared by Encoder to Binance and... it still works (this extra line feed and the end doesn't make a difference). I'll try later use Writer, not Write and see what happens. PS. Oh! One more thing to mention: this workaround only works with dev branch! |
I ran into the same problem, thank you for your help. |
I'm experiencing this same issue while using normal |
even if its not the issue with binance api, the newline thing is an issue i have had with other apis, and the best way i found to fix it was just to wrap the writer, since encoding/json writes the entire encoded json buffer to the underlying writer at once. eg:
i actually use this in one of my projects since it was an issue with a project i was doing, i just copied wsjson into that project. i copied it out here if anyone needs it |
Yea so binance doesn't support fragmented websocket frames for some reason. This library normally writes fragmented frames but the dev branch fixes it to not with |
can it be closed? |
Sure
wt., 2 maj 2023, 14:44 użytkownik Timo Friedl ***@***.***>
napisał:
… can it be closed?
—
Reply to this email directly, view it on GitHub
<#315 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABC3XDSKWJORDLVSZE6RHKLXED6TTANCNFSM5CSG442Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Actually I took another look at the code and v1.8.7 includes the fix to change So the fix here is don't use v1.8.8 will disable compression by default so it won't be an issue in the next release. Sorry for the confusion. |
Actually in v1.8.8 I'll change |
But I can still use |
Done in dev. |
Hi,
I have a weird problem using this package with Binance WebSocket API. Just after I got stream subscription confirmation, connection is closed (code 1008). At the beginning I was thinking about contacting with Binance support, but then I tried the same code but using Gorilla WebSockets package and... it worked fine.
Here is code nhooyr package version (not working):
And here is Gorilla version:
Any ideas what's wrong?
Thanks!
The text was updated successfully, but these errors were encountered: