-
Notifications
You must be signed in to change notification settings - Fork 61
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
Allow sending binary data without ArrayBuffer (e. g. IE8) #36
Conversation
@@ -102,6 +102,11 @@ exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) { | |||
return encodeBlob(packet, supportsBinary, callback); | |||
} | |||
|
|||
// might be an object with { base64: true, data: dataAsBase64String } | |||
if (data && data.base64) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice to check here for the number of keys not being any more than base64
and data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any suggestion to do this without introducing incompatibilities to older browsers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use something like https://github.com/ljharb/object-keys
+1 for next release |
Happy to see this will be integrated :-) Then I no longer need to manage my own forks. |
It'll come in |
Allow sending binary data without ArrayBuffer (e. g. IE8)
Thanks! |
I am working with binary data in the browser and – as far as I can see – I can receive binary data which comes as an object { base64: true, data: base64Data }.
BUT there is no way to do the same to send binary data. Sending binary data strictly requires an ArrayBuffer which is not available in older browsers.
I propose to introduce the same concept for sending binary data as for receiving binary data.
Sending an object { base64: true, data: base64Data } should send the data with binary flag to the wire.
This would allow older browsers to work binary. No need to modify server code nor client code. Only the
engine.io-parser needs a small modification.
This PR would resolve #35.
It adds the proposed way to send binary data for old browsers, including test.
Personally tested on IE8. It should support all browsers that https://github.com/feross/buffer supports too.
Any chance to get this integrated? Personally it would make engine.io the best socket library available because of its comprehensive binary support.
Thanks.