Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebRTC Next Generation #1721

Open
feross opened this issue May 25, 2018 · 8 comments
Open

WebRTC Next Generation #1721

feross opened this issue May 25, 2018 · 8 comments

Comments

@feross
Copy link
Member

@feross feross commented May 25, 2018

The WebRTC working group is soliciting use cases for the next version of WebRTC. I just posted my suggestions to the mailing list. Let me know if you have other suggestions that you want me to post on your behalf, or post them yourself (https://lists.w3.org/Archives/Public/public-webrtc/).

Here are my use cases for the next version of WebRTC:

Peer-assisted delivery.

  • See products from companies like PeerCDN (my company, sold to Yahoo), Peer5, and Streamroot. See open source projects like WebTorrent, PeerTube, etc.
  • All of these products would benefit from being able to use a ServiceWorker to intercept HTTP requests and then handle them via a WebRTC Data Channel instead. Currently, this requires creating the Data Channel in the main window and shuttling data back-and-forth between the main window and the ServiceWorker. If we add support for WebRTC Data Channel in Workers (see w3c/webrtc-pc#230) then these use cases become a lot easier to support. Less data copying, simpler architecture, better battery life, etc.

Distributed Hash Tables (DHTs).

  • DHTs are decentralized distributed systems that provide a lookup service similar to a hash table. DHTs are useful for finding peers without a central signaling infrastructure, and they're used in almost every widely-deployed peer-to-peer system, including BitTorrent, Bitcoin, IPFS, Dat, etc.
  • With the current WebRTC connection model, DHTs are nearly impossible to build. We need the ability to store the "contact information" for a peer, close the connection to that peer, and then re-connect to that peer at some point in the future (if they're still online). With TCP/UDP, this is quite easy to accomplish. Simply store the ip:port (12.34.56.78:9000) and try to connect. If the peer is still online, it will just work.
  • Peers need the ability to "listen" for incoming connections. Peers also need the ability to publish a "reusable SDP" that multiple peers can use to connect to listening peers (currently an SDP is usable only once)

Lighter-weight connections.

  • It seems that the current WebRTC spec is very complex (or perhaps currently implementations are still immature). But this leads to a situation where it's really hard to open more than a dozen connections at once without the browser process hitting 100% CPU utilization. This prevents applications that would like to open 20+ connections from doing so, which makes Data Channels a lot less useful for use cases like peer-assisted delivery, peer-assisted live streaming, WebTorrent, DHTs, in-browser cryptocurrency networks, etc.
@lgrahl

This comment has been minimized.

Copy link

@lgrahl lgrahl commented May 30, 2018

You may also want to ask your friends and colleagues what they would like to do peer-to-peer in the browser. Who knows what kind of interesting use cases people have held back.

@taowanzou

This comment has been minimized.

Copy link

@taowanzou taowanzou commented Jun 8, 2018

You are doing a fantastic job, I cannot even express how important it is. Donated some bch so please use it to buy smth to relieve stress once you feel exhausted, I dunno 🍕or beer 🍺 or smth else.

P.S. You can consider updating your bch address on thanks page so it is encoded according to CashAddr format, cause otherwise folks have to convert it (some wallets do not recognize base58check encoded bch addresses anymore).

@wmhilton

This comment has been minimized.

Copy link

@wmhilton wmhilton commented Jun 11, 2018

Is it sad that I can't figure out had to spend 5 minutes figuring out why mailto: links weren't working on my machine in order to "reply" to your mailing list email in the archive with a "+1"? And I still ended up sending a dual HTML/plain text formatted email instead of just plain text. Are mailing lists that hard to use or am I just not using the right tools?

Edit: For the record, I started out intending to write a basic "+1" message, but then I typed "If it worked in Service Workers," and then accidentally contributed a substantial idea, I think. Here's what I posted:

I just want to second everything that @feross just said. The browser needs
a way to:

  • persist peer connections and
  • periodically ping them to maintain an up-to-date list of peers.

If it worked in Service Workers, then it would work similarly to Web Push
Event API – a quick blast of data from a peer, maybe to notify that there
is new content, and it could decide whether to establish a full connection
and download that content now, or simply acknowledge the message, or
present a Push Notification to the user.

William Hilton
@wmhilton on github and twitter
Author of Isomorphic-Git

I may have just invented the notion of Peer Push Notifications.

@unicomp21

This comment has been minimized.

Copy link

@unicomp21 unicomp21 commented Jul 19, 2018

Why is this ServiceWorker thing taking so long? The second and third order consequences of getting it implemented are HUGE!!!

w3c/webrtc-pc#230

@taowanzou

This comment has been minimized.

Copy link

@taowanzou taowanzou commented Aug 29, 2018

Why is this ServiceWorker thing taking so long?

Rome wasn't built in a day

@guiprav

This comment has been minimized.

Copy link

@guiprav guiprav commented Sep 2, 2018

Very interested in this. I'm building a "web OS" of sorts (https://div-os.github.io/core/public/index.html) and one of the things I'm looking forward to build is web servers. Let users create a directory, write their index.html, styles.css, etc, and have the directory files served over WebRTC to any connecting peer.

With the use of WebRTC data channels inside a ServiceWorker, it would be possible to have the ServiceWorker serve those files from a remote WebRTC peer, effectively implementing a P2P website served from another user's browser.

@feross feross transferred this issue from another repository Sep 5, 2019
@SingularReza

This comment has been minimized.

Copy link
Contributor

@SingularReza SingularReza commented Sep 16, 2019

With the use of WebRTC data channels inside a ServiceWorker, it would be possible to have the ServiceWorker serve those files from a remote WebRTC peer, effectively implementing a P2P website served from another user's browser.

That's a cool idea! But can we make it work when only some pieces are downloaded?

@Tryptophan

This comment has been minimized.

Copy link

@Tryptophan Tryptophan commented Nov 19, 2019

Would it be possible to use this polyfill? https://github.com/johanholmerin/worker-webrtc Seems to at least support datachannels.

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

Successfully merging a pull request may close this issue.

None yet
8 participants
You can’t perform that action at this time.