Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Investigate uploading Blobs/ArrayBuffers #30

Closed
silverwind opened this Issue · 10 comments

2 participants

@silverwind
Owner

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.

@ZombieHippie
Collaborator

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
Owner

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

http://caniuse.com/websockets
http://caniuse.com/flexbox

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

@ZombieHippie
Collaborator
@silverwind
Owner

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
Owner

Thanks!

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

@ZombieHippie ZombieHippie removed their assignment
@silverwind silverwind changed the title from Investigate uploading Blobs to Investigate uploading Blobs/ArrayBuffers
@silverwind
Owner

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(blob);
ws.send(JSON.stringify({path || filename, type}));
ws.send(blob);

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

@silverwind
Owner

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.