-
Notifications
You must be signed in to change notification settings - Fork 61
utf8encode #80
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
Comments
Here are a couple interesting commits from the parser: It looks like at first, |
@calzoneman thanks for taking the time to look into that! If I understand correctly, I think that makes sense when mixing binary/string content in the same payload, since in that case the content type will be |
That's the part that I was missing (that you can send binary data and UTF-8 string data in the same polling payload). In that case, I guess what's happening is that for string-only payloads, they are being encoded twice (once by engine.io, and again when going over the wire). It might get a bit messy to try to selectively encode strings depending on the payload's content-type. This is also going to be a backwards-incompatible change for any client code using the polling transport. Not sure what the best solution is here. |
What do you think of #81? Does it make sense to skip utf8 encoding when dealing with payloads without binary content? |
That seems reasonable to me. I'm not sure how extensive socket.io's test coverage is; it may be worth re-running the test cases from the issues that prompted the |
|
Yeah, I'll need to change some stuff on the Swift client if things stop getting double encoded. |
Closed by #81 (will trigger a major release) |
A few questions:
encodePayload
anddecodePayload
be enough?Currently, it seems that:
-
encodePayload/decodePayload
is used for polling transport-
encodePacket/decodePacket
is used for websocket transportQuoting socketio/engine.io-client#140 (comment):
Is that really more efficient? Shouldn't we rather concatenate two packets instead of sending them one by one? (I think that's why, currently, sending a buffer with socket.io results in two frames: socketio/socket.io#2444)
Yet it seems that, since
encodePayload
always callencodePacket
withutf8encode
totrue
, the strings transmitted overpolling
transport are UTF8-encoded twice (socketio/engine.io#315):https://github.com/socketio/engine.io-parser/blob/1.3.2/lib/index.js#L229
cc @calzoneman @rase- @rauchg
The text was updated successfully, but these errors were encountered: