Datachannel stuck in 'connecting' state

1,306 views
Skip to first unread message

peter....@googlemail.com

unread,
Jul 10, 2018, 9:19:29 PM7/10/18
to kurento
I have a connection from KMS to a WebRTC device where I create a Datachannel on the Kurento side.
The connection works but the datachannel is stuck in the 'connecting' state (when checking the stats).
Strangely the KMS stats show bytes received if I send data over the datachannel from the WebRTC device though.

How can I debug why the datachannel is stuck in the 'connecting' stage?

Peter

peter....@googlemail.com

unread,
Jul 12, 2018, 9:46:55 PM7/12/18
to kurento
Does anyone have an example on how to use the datachannel in a setup that is a bit more complex than looping it back (which happens in the official KMS example)?

Kyle Foley

unread,
Jul 13, 2018, 10:37:11 AM7/13/18
to kurento

Hey Peter,

Are you using kurento-client-js? Also when creating the webrtcendpoints on the server side, are you specifying useDataChannels?

-Kyle

peter....@googlemail.com

unread,
Jul 16, 2018, 5:50:14 AM7/16/18
to kurento
Hi Kyle,

thanks.
Yes, I am using kurento-client.js and I set useDataChannels: true for the webrtcendpoint.

Peter

peter....@googlemail.com

unread,
Jul 19, 2018, 12:05:28 AM7/19/18
to kurento
The strange thing is really that the stats show data being transmitted - so it seems to be open for practical purposes. I just suspect that the 'connecting' state results in the problem not being able to connect the datachannel of this endpoint to another endpoint.

peter....@googlemail.com

unread,
Jul 19, 2018, 2:24:37 AM7/19/18
to kurento
I ramped up the debug levels but can't find any helping information there.

On a working WebRTC connection (video works), I create a datachannel:

2018-07-19 06:15:45,477179 19 [0x00007f78c0ff9700]   debug KurentoWebSocketTransport WebSocketTransport.cpp:422 processMessage()  Message: >{"jsonrpc":"2.0","method":"invoke","params":{"object":"ab12
39e3-30bb-4525-867b-795632709813_kurento.MediaPipeline/3a82c4f8-0514-4275-9223-30691f7727c0_kurento.WebRtcEndpoint"
,"operation":"createDataChannel","operationParams":{"label":"mydatachannel","ordered"
:true},"sessionId":"58cd9c7e-55ed-46b9-af78-c956fc71e7f4"},"id":23}<


Kurento answers - I always get value null back - is that normal?

2018-07-19 06:15:45,480015 19 [0x00007f78c0ff9700]   debug KurentoWebSocketTransport WebSocketTransport.cpp:424 processMessage()  Response: >{"id":23,"jsonrpc":"2.0","result":{"sessionId":"58cd9c7e-5
5ed-46b9-af78-c956fc71e7f4"
,"value":null}}

Then I check the stats:

2018-07-19 06:15:46,483356 19 [0x00007f78c8a67700]   debug KurentoWebSocketTransport WebSocketTransport.cpp:422 processMessage()  Message: >{"jsonrpc":"2.0","method":"invoke","params":{"object":"ab12
39e3-30bb-4525-867b-795632709813_kurento.MediaPipeline/3a82c4f8-0514-4275-9223-30691f7727c0_kurento.WebRtcEndpoint"
,"operation":"getStats","operationParams":{"mediaType":"DATA"},"sessionId":"58cd9c7e
-55ed-46b9-af78-c956fc71e7f4"
},"id":24}<

And get them:

2018-07-19 06:15:46,483652 19 [0x00007f78c8a67700]   debug KurentoWebSocketTransport WebSocketTransport.cpp:424 processMessage()  Response: >{"id":24,"jsonrpc":"2.0","result":{"sessionId":"58cd9c7e-5
5ed-46b9-af78-c956fc71e7f4"
,"value":{"7f4c0845-cdca-4957-8577-378dba08390f":{"__module__":"kurento","__type__":"RTCDataChannelStats","bytesReceived":0,"bytesSent":0,"datachannelid":0,"id":"7f4c0845-c
dca-4957-8577-378dba08390f"
,"label":"mydatachannel","messagesReceived":0,"messagesSent":0,"protocol":"","state":"connecting","timestamp":1531980946,"type":"datachannel"},"ffbb95f3-777b-4fe9-8fa5-58f1b
734d6e5"
:{"__module__":"kurento","__type__":"RTCPeerConnectionStats","dataChannelsClosed":0,"dataChannelsOpened":0,"id":"ffbb95f3-777b-4fe9-8fa5-58f1b734d6e5","timestamp":1531980946,"type":"session"}
}}}

As you see int the above: the state is 'connecting'. If I send data from the other side, the 'bytesReceived'  counter goes up accordingly though.


peter....@googlemail.com

unread,
Jul 19, 2018, 4:25:11 AM7/19/18
to kurento
btw: the other side tells me DTLS handshake completed and data channel open.

CarD

unread,
Apr 24, 2019, 2:56:34 AM4/24/19
to kurento
I am finding the same problem, in Firefox I am not able to connect my datachannel but in Chrome it is working perfectly. Does anyone know why?

Juan Navarro

unread,
Apr 25, 2019, 2:20:30 AM4/25/19
to kurento
Hi,

Datachannels have been used by several Kurento users without issues, there is even since Kurento 6.8 the ability to mix Datachannels with the Composite element, and everything was working properly...

If you say it works for you, but the only problem is "connecting" state in the stats, I'm just giessing but maybe it's just a bug that is preventing the stats to get updated.

CarD

unread,
Apr 25, 2019, 2:40:38 AM4/25/19
to kurento
Hi,

In my case it is working on Chrome but in Firefox I am not able to use the datachannel as it is never opened. I am using nodejs to connect to the Kurento media server I have on an ubuntu 16:

  room.pipeline.create('WebRtcEndpoint', {useDataChannels: true}, (error, webRtc) => {
      webRtc.on('DataChannelOpen', function () {
                console.log("--------------Data channel opened.--------------");
      });
 });


In my javascript:

   pc = new RTCPeerConnection(pc_config);
  dataChannel = pc.createDataChannel('send', {reliable: false});
  dataChannel.binaryType = 'arraybuffer';
  dataChannel.onerror = function (error) {
                      console.log(error);
                    };
  dataChannel.onmessage = function (event) {
                        console.log(event);
                    };
  dataChannel.onclose = function () {
                        console.log('close data');
                    };
  dataChannel.onopen = function () {
                        console.log('OPEN');
                    };
  pc.ondatachannel = e => {
                console.log('ondatachannel')
            }

I hope you can help me, thank you

Juan Navarro

unread,
Jun 2, 2019, 4:24:44 PM6/2/19
to kurento
The SDP syntax changed in Firefox and will soon change in Chrome too; for that reason Kurento is not able to process it correctly.
We are aware of this issue and will try to fix it as soon as possible, hopefully it can be solved for the next release (no release date yet, though)

Any progress with this issue will be tracked here:

Juan Navarro

unread,
Jul 17, 2019, 10:04:05 AM7/17/19
to kurento

Please check out the fix branch fix-datachannel-sdp and give some feedback to let us know if the problem is solved.


You can try it out either with apt-get install, using this repository line (Ubuntu Xenial only):

deb http://ubuntu.openvidu.io/fix-datachannel-sdp xenial kms6


or with the experimental Docker image (https://hub.docker.com/r/kurento/kurento-media-server-exp):

kurento/kurento-media-server-exp:fix-datachannel-sdp
Reply all
Reply to author
Forward
0 new messages