-
Notifications
You must be signed in to change notification settings - Fork 115
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
Add support for WebRTC Data Channel in Workers #230
Comments
+1 |
Another use case for using WebRTC in a SharedWorker is a DHT, a decentralized/distributed lookup service (similar to a hash table). Useful for routing to nodes in decentralized applications. |
This would be fantastic! It will really make the WebRTC Data Channel even more powerful. |
Hi! You should push for this feature on the WebRTC WG's mailing list, public-webrtc at w3.org. |
Hi. |
I made a proposal on the mailing list: https://lists.w3.org/Archives/Public/public-webrtc/2015May/0157.html |
Here are the relevant issues in the various developer communities: |
+11 Access WebRTC API in Workers and support transfer of MediaStream objects through the Message API. |
Given the process on how to determine what is in/out of 1.0 (https://lists.w3.org/Archives/Public/public-webrtc/2015Jul/0060.html) the best thing to do if you'd like to see this feature is probably to create a pull request and try to get some discussion around it. |
From the answers, it seems like you have to change the WebRTC API ?? |
+1 |
2 similar comments
+1 |
+1 |
Great news! +1 On Fri, Jan 8, 2016 at 7:42 AM stefan hakansson notifications@github.com
|
Excellent news. Very much looking forward to this! |
Based on the silence, marking this LATER (beyond 1.0). |
Absolutely +1! |
Closing with intent to reopen "later". |
Is it "later" yet? There are some really cool tricks one would be able to do with, say, ipfs/js-ipfs and a ServiceWorker, to serve assets from the IPFS network and have them appear to the page like normal HTTP-based assets. Currently you have to figure out how to connect a NodeJS-style stream to, say, an |
No, "later" is after webrtc-pc has gone to CR. |
Creating a browser "refresh resistant" WebRTC data channel in a shared worker could potentially change the way web apps are built forever! It's a shame not much has happened here in over 3 years... |
It have been quiet for a while now, haven't heard anything new. Some related PR/issues have been closed. So I got some few question.
|
Someone actually doing the work and putting in the time and work to spec and then write support for workers. |
@jimmywarting @benjamingr The "work" would probably involve implementing the RTCDtlsTransport and RTCDataChannel interfaces from ORTC, in addition to WebRTC-ICE which had an Origin Trial in Chrome last Spring along with WebRTC-QUIC. The big question is whether there is enough motivation for browser vendors to support |
Maybe they should focus more on improving what people are actually "stuck with" using right now? Just a thought... |
I was excited today to move the WebTorrent part of my app to a worker for increased performance, but then I saw this issue, a big letdown :/ It's a shame that even after 5 years, this hasn't been implemented :( |
You have several options for recourse:
|
An implementation of a fix to this issue would be making just RTCDataChannel available in just (ordinary, Web, non-Service) Workers, right? Along the lines of #317 or #445, you would be able to send an already open RTCDataChannel to a Web Worker, but a Web Worker would not be able to open any new connections (because of not having RTCPeerConnection) and a Service Worker wouldn't be able to use either. (As pointed out here by @martinthomson, a Service Worker is supposed to only be spun up for a few seconds at a time to handle a request, and giving it a peer to peer connection causes trouble with that model that people did not want to solve at the time.) I'm not sure a fix to this issue would then really provide what @jimmywarting, @nkev, and others are asking for, which is a way to host a useful peer-to-peer node in a browser in the background (or at least independent of any single tab), in a context where it can idiomatically service requests. I'm going to open an issue to track providing the whole WebRTC API to all types of workers (including Service Workers) in a way that is useful for p2p content distribution but which doesn't buy you infinite service worker runtime for every site the user ever visits. Actually fixing that bigger issue is where a lot of the hardness is, it seems, and probably shouldn't block a fix for this issue for whoever actually needs exactly the functionality of shipping an RTCDataChannel specifically to a Web Worker specifically. |
@interfect Thank you for the useful response and not dismissing this with "build it yourself or pay someone else to build it". |
@nkev I'm not actually one of the actual spec group project members either; I want this feature for my use case too. But I can see how it can get on their nerves to have people showing up periodically asking why their pet issue isn't ready yet, so I decided to try to grab a metaphorical shovel to the extent that I can. Where we might still get stuck is browser implementations. I'm pretty sure I can fiddle with a spec document, but I'm not really a qualified browser dev and even if I were I have no leverage to get an implementation merged. I'm hoping some actual browser devs will come by and implement it for me (which might go better if this is attached to the next version of WebRTC like @alvestrand suggested, which is going to need implementing anyway). |
Can All the logs at https://rustwasm.github.io/wasm-bindgen/exbuild/webrtc_datachannel/ are on line 333 in index_bg.js:333. |
@lgrahl FWIW |
Linking w3c/webrtc-extensions#64 |
Hi, I'm a p2p protocol developer with millions of monthly active users. And unlike the others, I beg and plead you to NOT implement this until Is fixed. Any WebWorker feature that allows for external communication is a huge data exfiltration and security risk. Thank you. |
Transferring to a worker has since been specced in https://github.com/w3c/webrtc-extensions |
Any updates on this? |
The WebRTC-Extensions specification includes support for WebRTC Data Channel in Workers. However, at least one shipping implementation is required to move the spec into WebRTC-PC. |
@aboba - doesn't the following mean that Safari has a shipping implementation of WebRTC Data Channel transfer to workers (including service workers)? |
Yes. For some reason, the tests have been failing on all browsers recently, so I missed that: |
Any news on this? A growing-in-importance topic and no implementations yet... :-( |
WPT.fyi indicates that tests are passing (on Safari TP 192): https://wpt.fyi/results/webrtc-extensions/transfer-datachannel.html?label=experimental&label=master&aligned |
Proposal
Support WebRTC Data Channel in Workers (
WebWorker
,ServiceWorker
, etc.)WebRTC DataChannel is basically a drop-in replacement for
WebSocket
, except it's peer-to-peer. For all the same reasons thatWebSocket
was added to theWorker
spec, we should add WebRTC DataChannel.Use Cases
DataChannel in a
ServiceWorker
would support the use case of "peer assisted delivery" a la WebTorrent, CDN/P2P CDN video streaming delivery, file transfer, etc.DataChannel in a
WebWorker
would support offloading CPU intensive data transfer/processing to another thread.What about security?
Using WebRTC data channels in a worker is no different from a security/privacy perspective than using WebSocket. There's no user permission prompt to open a WebRTC data channel.
The text was updated successfully, but these errors were encountered: