-
Notifications
You must be signed in to change notification settings - Fork 6
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
Slow because data is fetched one byte at a time #11
Comments
@tarui Sorry, late. That's makes sense. Could you provide script to send-and-read MB order packets data with this gem? |
Not late at all! |
I tried it and confirmed. Increasing buffer size is reasonable. Thank you report! |
I investigated it. I think using |
Thank you for your researching. So that means we need to handle the encoding correctly. And that seems a bit cumbersome considering the buffer runs out in the middle of a character. |
I checked RFC6455. Certainly there could be discrepancies at that stage, but in the first place, since it is a binary-packed packet at this layer, isn't this String treated as binary at the latter stage? |
I see. It changes the behavior, but using readpartial may not cause any major problems. |
The following section, reading data one byte at a time, is very slow when trying to handle MB-order packets.
websocket-client-simple/lib/websocket-client-simple/client.rb
Lines 46 to 49 in 857bc87
Simply replace with the following to speed up the process. I didn't make a pull request because I wasn't sure what to specify as a buffer size, but I hope you will consider replacing it.
The text was updated successfully, but these errors were encountered: