Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Investigate uploading Blobs/ArrayBuffers #30

silverwind opened this Issue Feb 18, 2014 · 10 comments


None yet
2 participants

silverwind commented Feb 18, 2014

FormData has quite a few cross-browser issues and also adds the overhead of a multipart-parser on the server. It might be cleaner to just upload Blobs (or ArrayBuffers) over the Websocket instead.


colelawrence commented Feb 18, 2014

This is different than streaming binary right? It should make everything easier, but mobile devices don't really support raw websockets so we also need to be sure socket.io would support blobs from Android or Safari Mobile.


silverwind commented Feb 19, 2014

WebSocket support actually isn't that bad anymore, it's pretty much the same as for Flexbox flexbox-support, which I require:


I'd say it's too much work to support a non-flexbox layout, so I think we'll stay on raw sockets.


colelawrence commented Feb 19, 2014

Okay, cool I was unaware


silverwind commented Feb 19, 2014

Android's default browser is the only one in that list, that only recently got these two features, and it's in a pretty dire state of supporting other much-needed features. I fully support IOS7/Chrome on Android though, fyi.


silverwind commented Feb 20, 2014


(I'll assign us to the issues, so we can keep track)

@colelawrence colelawrence removed their assignment Mar 2, 2014

@silverwind silverwind changed the title from Investigate uploading Blobs to Investigate uploading Blobs/ArrayBuffers Aug 3, 2014


silverwind commented Mar 28, 2015

Tested a bit with binaryjs, but it seems to be a lot slower (at least factor 5) than the current formdata method, apparently because the client is heavily cpu limited while uploading. Not really an alternative.

One way I could see this work is by mixing binary and string types on the socket:

ws.send(JSON.stringify({path || filename, type}));
ws.send(JSON.stringify({path || filename, type}));

To get the blob, we need to use a FileReader, which I'm not sure how it would perform on big file trees.


silverwind commented Mar 31, 2015

Probably not worth the trouble right now. We'd loose browser compat and speed by doing this.

One planned improvement I have in mind is moving the uploading to a worker process. That should avoid the browser hangs when uploading big trees. Main blocker here is Firefox, which will get FormData in workers in 39.

@silverwind silverwind closed this Mar 31, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment