PeerConnection on WebWorker

241 views
Skip to first unread message

pir...@gmail.com

unread,
Feb 23, 2013, 8:49:40 PM2/23/13
to discuss...@googlegroups.com, public-webrtc
I've got this issue on Chrome v24 and v26, but I think it's related
with the specificacion since I didn't see anything about it there.

I'm trying to create a PeerConnection (to later create a DataChannel
from it) from inside a WebWorker, with the idea of use in the future a
SharedWorker. My intention is to move all the logic of my application
(a P2P filesharing application) to a SharedWorker and leave only on
the window thread the UI related code, so it can be accessed from
several browser tabs at a time, and also have the option to easily use
a WebSocket to a remote server running the logic of the application
instead against the local WebWorker/SharedWorker (the API is almost
the same, only one using send() method and the other usind
postMessage() method. I truly don't know why that difference between
both, but this a different story...). The problem is that trying to
create the PeerConnection inside the WebWorker it tell me that both
webkitRTCPeerConnection and RTCPeerConnection are not defined, so I
suppose this use case was not considered by the specification.

A temporal solution would be that the WebWorker send back the
petitions to use the PeerConnection object to the window thread and
process them there, but this would over complicate the application
architecture and also decrease performance.

Any clue about this topic?


--
"Si quieres viajar alrededor del mundo y ser invitado a hablar en un
monton de sitios diferentes, simplemente escribe un sistema operativo
Unix."
– Linus Tordvals, creador del sistema operativo Linux

Justin Uberti

unread,
Feb 23, 2013, 11:55:54 PM2/23/13
to discuss-webrtc, public-webrtc
Web Workers can't manipulate the DOM, including PeerConnection.



--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



PhistucK

unread,
Feb 24, 2013, 1:45:26 AM2/24/13
to discuss...@googlegroups.com, public-webrtc
Is there a concrete reason why not?
It is not related to the actual DOM, after all. Data channels can be used without any relation to the DOM.

PhistucK

Alexey Aylarov

unread,
Feb 24, 2013, 3:06:51 AM2/24/13
to discuss...@googlegroups.com, public-webrtc
I think that probably it could be an interesting concept - try to use web workers to support connection while page is reloaded or URL is changed. Of course, it should work with the same domain only and there are a lof of other questions related to web workers, but at least it's something that is already implemented and can be used to solve the problem "no way to reload the page without dropping the connection"

pir...@gmail.com

unread,
Feb 25, 2013, 11:13:38 AM2/25/13
to Alexey Aylarov, discuss...@googlegroups.com, public-webrtc

Also another advantage of this would be to increase throughtput of DataChannels when used intensively as in my application since working from inside the WebWorker they don't get interfered from the main UI thread.

Sent from my Android cell phone, please forgive the lack of format on the text, and my fat thumbs :-P

El 24/02/2013 23:51, "Alexey Aylarov" <ayl...@gmail.com> escribió:
Reply all
Reply to author
Forward
0 new messages