Re: [discuss-webrtc] Status of DataChannel?

532 views
Skip to first unread message

Tommy Widenflycht (ᛏᚮᛘᛘᚤ)

unread,
Nov 5, 2012, 4:04:02 AM11/5/12
to discuss...@googlegroups.com
DataChannels was added to WebKit a while back but Chromium hasn't implemented it yet, that's why you get the "not supported" exception. 

On Thu, Nov 1, 2012 at 12:57 PM, Jesús Leganés Combarro <pir...@gmail.com> wrote:
When using the PeerConnection.createDataChannel() method on Chrome 24, when calling it without parameters it raise a 'not enought parameters' error, when according to spec it should be threated as being and empty string, but when adding any string there I get a 'non supported error' exception (code 9). Is DataChannel ready to be used or I'm doing something wrong?

To check this you can use https://github.com/piranna/DataChannel-polyfill test. The polyfill works correctly on Chrome/Chromium v23, but on Chrome v24 it detects the native DataChannel support and use it instead, but when calling to createDataChannel on test/client.js:119 it gets the problems shown above.

--
 
 
 

PhistucK

unread,
Nov 5, 2012, 4:14:04 AM11/5/12
to discuss...@googlegroups.com
This fails feature detection a bit, I would say... can you make it not appear on the RTCPeerConnection instance until it is actually implemented?

PhistucK



--
 
 
 

Tommy Widenflycht (ᛏᚮᛘᛘᚤ)

unread,
Nov 5, 2012, 5:42:19 AM11/5/12
to discuss...@googlegroups.com
That is possible if needed but it isn't hard to check if you get a "not supported" exception with something like this:


The reason for the discrepancy is that chromium and webkit are two separate open source projects and features has to be added to webkit first.

--
 
 
 

Tommy Widenflycht (ᛏᚮᛘᛘᚤ)

unread,
Nov 5, 2012, 5:44:45 AM11/5/12
to discuss...@googlegroups.com
try { 
    pc.createDataChannel("foobar"); 
} catch (e) { 
    if (e.name === "NOT_SUPPORTED_ERR") {  

PhistucK

unread,
Nov 5, 2012, 6:33:38 AM11/5/12
to discuss...@googlegroups.com
I know and I understand the reason, but it would be better to just not have it there in the first place. Those try/catch clauses can slow down the script execution and prevent optimizations in V8.

PhistucK



--
 
 
 

Harald Alvestrand

unread,
Nov 5, 2012, 6:43:14 AM11/5/12
to discuss...@googlegroups.com
On Mon, Nov 5, 2012 at 12:33 PM, PhistucK <phis...@gmail.com> wrote:
I know and I understand the reason, but it would be better to just not have it there in the first place. Those try/catch clauses can slow down the script execution and prevent optimizations in V8.

Just a random opinion.....

If you do createDataChannel every few milliseconds, I think you're doing it wrong.
If you don't do createDataChannel every few milliseconds, I think optimizing this part is the wrong place to look.

The need for that code will disappear as soon as the data channel is in place in Chrome; I don't think anyone long term plans to deliver a PeerConnection without a DataChannel, so adding yet another flag inside Webkit is also adding more cruft for a short term reason.


--
 
 
 

Jesús Leganés Combarro

unread,
Nov 9, 2012, 6:44:02 AM11/9/12
to discuss...@googlegroups.com
Sorry to answer so late, I forgot to add e-mail notification :-P Thanks a lot for clarifying the current implementation status and how to improve the polyfill detection, it will be easy to add to the code :-) I'll do it later and send you a message when it's ready :-)

P.D.: yes, I'm the creator of the DataChannel polyfill, I forgot to mention it earlier... :-P

Jesús Leganés Combarro

unread,
Nov 9, 2012, 9:02:13 AM11/9/12
to discuss...@googlegroups.com
Ok, I have just added the support detection proposed by tommyw and uploaded to the GitHub repository. The problem is that with Chrome v24 doesn't work because for some reason the remoteDescription is not being filled and the PeerConnection gets holding on the openning state, the good news are that if I fix this, maybe I could be able to fix it also for Firefox and could be able to test it on native implementations :-)

Jesús Leganés Combarro

unread,
Nov 9, 2012, 11:40:38 AM11/9/12
to discuss...@googlegroups.com
Fixed and uploaded, now it works both on Chrome v23 and Chrome v24 thanks to the tommyw test code, and fixed some closure related bugs :-) Maybe there would be problems sending messages between two browsers of different versions so the PeerConnections gets holding on the openning status, but it works almost all the time also with several tabs open (so maybe it's a fault of my backend server code...). You can find the latest version at the test folder on https://github.com/piranna/DataChannel-polyfill :-)
Reply all
Reply to author
Forward
0 new messages