Open Bug 922363 Opened 6 years ago Updated 2 years ago

Add support for WebRTC (DataChannels) on WebWorkers (SharedWorkers and ServiceWorkers)


(Core :: WebRTC: Networking, enhancement, P4)




Blocking Flags:


(Reporter: piranna, Unassigned)


(Depends on 1 open bug)


(Keywords: dev-doc-needed, Whiteboard: [webrtc][games:p3][platform-rel-Games])

User Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/28.0.1500.71 Chrome/28.0.1500.71 Safari/537.36

Steps to reproduce:

As can be read on , I've been trying to create and use WebRTC PeerConnection objects from inside a WebWorker, just to notice that the PeerConnection class is not defined inside WebWorkers.

Expected results:

PeerConnection class should be allowed to be used inside WebWorkers (and SharedWorkers and upcoming ServiceWorkers, too) since it's just related to network comunications (specially DataChannels) and don't has direct relationship with any DOM content. This would allow for example to keep open connections between page reloads or transfer data between peers on background.
Component: Untriaged → WebRTC: Networking
Product: Firefox → Core
Having PeerConnections/mediastreams/etc available in workers would be handy, but is definitely a ways in the future (and would likely only really be useful if agreed to by others in the WG)
Severity: normal → enhancement
Ever confirmed: true
OS: Linux → All
Hardware: x86 → All
Whiteboard: [webrtc]
Depends on: ServiceWorkers
Handling DataChannels (once created) should be easier than creating or interacting with PeerConnections or the media streams associated with them.  It may be able to leverage work done to support WebSockets in workers and the work currently underway to somewhat isolate the internal DataChannel impl from the DOM side so we could reuse it in places like node.js (with some more work) and in C++ unit tests where no window is available
Are you talking about passing already created DataChannels to the worker so it can use it, passing the already created PeerConnection so the DataChannel can be created from inside the WebWorker, or about allow to create both PeerConnection and DataChannels objects from inside the WebWorker (this would be the best solution for me) but no audio nor video streams, allowing them to only be created from the main thread?

Honestly, I'm mainly interested on DataChannels (but anyway audio & video streams would be a plus... ;-) ) so for me any of them would be a good solution on the short time :-)
Simplest (by far) to support would be passing already-created data channels to a worker I believe - and there may be some real issues doing that, which is why I want to tie it to doing something similar for WebSockets.
Ok, I agree then on link progress of this issue (at least on its first iterations) to be on pair of passing WebSockets to WebWorkers due to their similar API and internal infraestructure once the are created (just a plain ol' BSD socket :-) ). Do you know of any bug issue that could be put as dependence of this one?
Spec work will be involved per above, though we can start experimenting
backlog: --- → webRTC+
Rank: 35
Priority: -- → P3
Whiteboard: [webrtc] → [webrtc][games:p3]
Whiteboard: [webrtc][games:p3] → [webrtc][games:p3][platform-rel-Games]
platform-rel: --- → ?
platform-rel: ? → ---
Mass change P3->P4 to align with new Mozilla triage process.
Priority: P3 → P4
You need to log in before you can comment on or make changes to this bug.