0

This question has been answered: Do websockets allow for p2p (browser to browser) communication?

The answer is no.

My question is: are there any plans for this? Any speculative draft by the W3C or whoever, planning this capability? (I have googled and found nothing, but I'm not sure if I'm searching the wrong thing.)

There is the WebSockets API, which allows you to, for example, transfer files from one user to another quite efficiently (like http://jetbytes.com/ and some others I've seen). I believe these work by piping the file through the server - it's very light on the server, as it doesn't have to store each chunk after its sent to the receiving client. But it does use the server's bandwidth twice (down and up) for each file transfer.

It would be more efficient (for server and both clients) if the server could just pass the IP address (and a port?) of each client to the other, and the entire data transfer could take place between them.

For security, the browser could prompt each user to give permission ("This website, example.com, wants to connect you to IP address 1.2.3.4 to receive a file transfer of 23MB. Allow/Refuse?").

If there are no plans to publish a spec on this, why not?

Community
  • 1
  • 1
callum
  • 34,206
  • 35
  • 106
  • 163
  • Just a guess: If someone were to develop a method to use your Browser as a P2P filesharing client, then they may have to treat Internet Explorer the same way that they've treated Napster, KaZaA, Limewire, etc. – drudge Feb 22 '11 at 22:47
  • With a system like I'm describing, you can't offer the contents of your computer to be indexed and searched by other, anonymous users. In the web app, you select a file on your computer, the app checks the size and details, and gives you a URL for downloading it. You send the URL to someone, they connect, and click download, and the transfer starts. – callum Feb 23 '11 at 09:03
  • Sorry, I should clarify... my point is: it's more analogous to emailing an attachment to someone than general filesharing. It wouldn't be possible to set up a Limewire-like web app unless people's _browsers_ allowed users to share all their files (so they can be indexed and downloaded by whoever, whenever). If a browser did choose to enable this, then it wouldn't be a browser, it would be a browser with a built-in P2P filesharing client. Which is already perfectly possible - any browser could implement this with existing P2P protocols, but they don't, because it's not in their interests. – callum Feb 23 '11 at 11:17

2 Answers2

3

There is a proposed standard for P2P data exchange in web apps: WebRTC Data Channel API.

Example JavaScript implementations include PeerJS, BoneValue and WebRTC.io.

niutech
  • 28,923
  • 15
  • 96
  • 106
1

Some RFC's have been implemented to solve parts of the problem (i.e., NAT traversal), but whole problem is pretty complex and I doubt their will ever be a complete official standardization.

What you are suggesting is in fact TURN and STUN implementations of P2P frameworks. It 'looks' easy, but when you get in the details, it is a complex technical issue (and I am not even mentioning security). It is not just a matter of passing IP addresses.

If you want more details, read the NAT traversal chapter from the Practical JXTA II book available online for reading at Scribd.

Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453