Show HN: DirtyShare, Pure JavaScript P2P File Sharing (in Node.js + Socket.io)
gun.io
gun.io
The server is written in node.js and it uses socket.io to do the transfers. I think it only works in Chrome because I didn't bother getting the drag-and-drop working with anything else. Actually, it seems to be broken in the current dev channel of Chrome. I announced it back in September:
https://plus.google.com/116396240707733722472/posts/d9ydb8o2...
Also: in further testing, it looks like Safari works with the drag and drop, but not the uploading. I purposely disabled all socket.io transfer types except web sockets in order to encourage adoption of modern browsers. Unfortunately, since I used such bleeding edge, unstandardized technology (drag and drop, file API, and web sockets), the browsers have changed and broken my implementation, each in a slightly different way, such that none of them work end to end anymore.
This just goes to show that you have to be vigilant if you are building sites with the latest and greatest, as they are still under development and likely to change out from under you.
I'm pretty sure that if you just "connect the uploader's POST to the downloader's GET" then the Node server would have to buffer the entire file from the submitter before sending it to the clients.
Not at all. Use stream.pipe(). I've done it countless times and it works really well.
Why can't I drag-> drop files in?
Drag and Drop was working, but I broke it again (file input is handled differently in different browsers, which was a headache) and I just wanted to get some more eyes on it.
As for True P2P - give it a few months. Once WebRTC is here, this will be very very easy to turn into proper P2P.
Though WebRTC might be the 'right', standards-based way for peer-to-peer web communications, I'd be wary of depending on it arriving, with the right features, in any necessary time frame. Incumbent-organization standards efforts often don't deliver with the boldness and promptness that edge innovation needs.
Maybe you'll need to give (some subset of) users a plug-in or node.js daemon, that runs alongside their browser as a connectivity hack-around, in the meantime. Aesthetically impure, yes, but such compromises are another kind of 'schlepping' that sometimes enables breakaway project success.
Compared to a uniform resource locator on top of a dynamic, distributed naming system connected by a robust, global packet-switching network, I'd say this new system is way less "content-centric" and way more sensitive to the content's source.
Once the remaining browser pieces are in place (via either WebRTC or another shim), a content-centric DHT beyond just shared folders could be the next step. You could have "trackerless torrenting in a tab". Or even "Tor-in-a-tab".
In an earlier version of Sendoid, we were doing exactly this to handle the "larger than reasonable" in-browser sharing issue. We had some privacy concerns at the time with still requiring what was essentially a data proxy server in the middle and eventually removed the functionality when the desktop application was released.
WebRTC is really exciting from a private data transfer perspective and will hopefully start getting us out of the "server-in-the-middle" architecture that we've had to live on for so long with in-browser data transfer. As an added plus, it would be another nail in flash's coffin for live video chat, which is really just a live data transfer problem after all.
I have opened an issue about this here: https://github.com/Miserlou/DirtyShare/issues/3
This is the page I used a lot for researching this project: http://www.html5rocks.com/en/tutorials/file/filesystem/
Presumably this new service is less expensive to run because there's no disk storage involved, just a central server providing bandwidth and a little bit of RAM to buffer with. And presumably with WebRTC it won't even need that, and will just become a service to easily connect browsers.