6 ms·
This is an anti-pattern. The HTTP spec already sends files to web browsers, and it can send many files in parallel.
by wavephorm 15y ago
This is an anti-pattern. The HTTP spec already sends files to web browsers, and it can send many files in parallel.
- deleted 15y ago[deleted]
- deleted 15y ago[deleted]
- firefoxman1 15y agoBut does it support file pushing? I think that's the only special thing about this library.
- shaka881 15y agoIt's not pushing, the browser still has to poll - it's just enqueueing files for transfer, right? Even if that use case has some utility (of which I'm dubious), it still needlessly breaks the addressability semantics of URLs. It would be much better, in my opinion, to have the backend issue redirect to an unambiguous URL that refers to the static resource, then let the web server do the thing it's good at.
- firefoxman1 15y agoIt only uses polling if the browser doesn't support WebSockets, in which case socket.io would fall back to another method. Otherwise it is truly pushing. From looking at the source, it looks like it encodes the file as a DataURL in base64 to send the files.
- a-priori 15y agoSo push the URL over a WebSocket, and then download the data over HTTP.