Skip to content
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

WebRTC SCTP data channels transmit/receive no data to/from Chrome/Chromium 32+, FF28+ #1526

Closed
longsleep opened this issue Jan 30, 2014 · 15 comments
Assignees
Labels
Milestone

Comments

@longsleep
Copy link

@longsleep longsleep commented Jan 30, 2014

The WebRTC data channels in node-webkit 0.9.0-rc1 do not work when connected with a peer which is not node-webkit 0.9.0-rc1. Funny thing is that Opera 19.0.1326.47 seems to have the very same issue and can only transfer SCTP data with itself or with node-webkit.

Chrome all versions including 32.0.1700.77 work fine with all later Chrome versions and also with Firefox 28 and 29.

I saw the very same issue with a single Chromium release in the past (see https://code.google.com/p/chromium/issues/detail?id=324484), but the issue went away with later Chromium. So maybe some setting or third party library is responsible which was not updated with the node-webkit 0.9.0-rc1 build and thus the SCTP data channels are somehow not compatible with the ones in Chromium builds and FF.

I will add the same issue to Opera.

Test case:

  1. Create WebRTC connection between Chrome 32+ and node-webkit 0.9.0-rc1 with an SCTP data channel ({reliable: true}).
  2. Send a string through the data channel.

What is the expected behavior?
The string sent should be received on the other end.

What went wrong?
Nothing is received, no matter if sent from 32 or 33 or from 33 to 32 or Firefox 29. No errors are raised on the Javascript side either.

Works with when connected to another node-webkit 0.9.0-rc1 or to Opera 19.

@rogerwang rogerwang modified the milestones: v0.9.1, v0.9.0, 0.9.2 Feb 7, 2014
@rogerwang
Copy link
Member

@rogerwang rogerwang commented Feb 18, 2014

I tested nw 0.9.1 linux. It's working with Chrome 32.

The demo I'm using is https://bitbucket.org/webrtc/codelab/overview step7 folder

with this patch to use SCTP:

diff --git a/complete/step7/js/main.js b/complete/step7/js/main.js
index 7daf56c..0dc7f4c 100644
--- a/complete/step7/js/main.js
+++ b/complete/step7/js/main.js
@@ -161,7 +161,7 @@ function createPeerConnection() {
     try {
       // Reliable Data Channels not yet supported in Chrome
       sendChannel = pc.createDataChannel("sendDataChannel",
-        {reliable: false});
+        {reliable: true});
       sendChannel.onmessage = handleMessage;
       trace('Created send data channel');
     } catch (e) {
@longsleep
Copy link
Author

@longsleep longsleep commented Feb 18, 2014

Ok - thanks for providing the link. I will check what might be the difference with my code and maybe i find the reason or can provide an example which does not work.

@rogerwang rogerwang self-assigned this Feb 20, 2014
@rogerwang rogerwang modified the milestones: TBD, 0.9.2 Feb 20, 2014
@varuzhnikov
Copy link

@varuzhnikov varuzhnikov commented Feb 21, 2014

Hi! I'm trying to get work following code with peerjs.
Here is index.html, which works in webkit:

<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
<script>
  var peer = new Peer('someid1', {host: 'localhost', port: 9000});
  // ADDED THIS:
  peer.on('open', function(id) {
    console.log('My Peer is is: ' + id)
    var conn = peer.connect('someid2', {reliable:true});
    console.log(conn.label)
    console.log("REMOTE connecting to LOCAL", conn)

    conn.on('error', function(err) {
        console.log('error')
        console.log(err)
    });

    conn.on('data', function(data) {
        console.log('on data')
        console.log('Received', data);
    });


    conn.on('open', function(){  
      console.log("connect to REMOTE opened", conn);
      console.log('before sending hi')
      conn.send('hi!');
    });
  }); 

  peer.on('close', function() { 
    console.log('peer destroyed')
  });

  peer.on('error', function(err) {
      console.log('error peer')
      console.log(err)
    });
</script>

Here is remote peer code which accepts connections and data peer2.html:

<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
<script>
  var peer = new Peer('someid1', {host: 'localhost', port: 9000});
  // ADDED THIS:
  peer.on('open', function(id) {
    console.log('My Peer is is: ' + id)
    var conn = peer.connect('someid2', {reliable:true});
    console.log(conn.label)
    console.log("REMOTE connecting to LOCAL", conn)

    conn.on('error', function(err) {
        console.log('error')
        console.log(err)
    });

    conn.on('data', function(data) {
        console.log('on data')
        console.log('Received', data);
    });


    conn.on('open', function(){  
      console.log("connect to REMOTE opened", conn);
      console.log('before sending hi')
      conn.send('hi!');
    });
  }); 

  peer.on('close', function() { 
    console.log('peer destroyed')
  });

  peer.on('error', function(err) {
      console.log('error peer')
      console.log(err)
    });
</script>

If I run these code in different window chrome browsers then I get such output:
index.html >>>>>
My Peer is is: someid1
dc_9t5698cttbuik9
REMOTE connecting to LOCAL
DataConnection {_events: Object, options: Object, open: false, type: "data", peer: "someid2"…}
connect to REMOTE opened
DataConnection {_events: Object, options: Object, open: true, type: "data", peer: "someid2"…}
before sending hi
on data
Received Hello!

peer2.html >>>>
My Peer is is: someid2
LOCAL connection open
DataConnection {_events: Object, options: Object, open: true, type: "data", peer: "someid1"…}
before data
LOCAL got message hi!

But when I launch index.html in node-webkit then following output I get:
index.html>>>>
My Peer is is: someid1
dc_4ydx86ya8nbnvcxr
REMOTE connecting to LOCAL
DataConnection {_events: Object, options: Object, open: false, type: "data", peer: "someid2"…}
connect to REMOTE opened
DataConnection {_events: Object, options: Object, open: true, type: "data", peer: "someid2"…}
before sending hi

peer2.html>>>>>
My Peer is is: someid2 peer2.html:7
LOCAL connection open
DataConnection {_events: Object, options: Object, open: true, type: "data", peer: "someid1"…}
peer2.html:25
before data

So, connection is established but no data is transmitted or no 'data' event emitted.

Chrome browser version Version 33.0.1750.117 And all above code works there

Node-webkit chromium version Version 32.0.1700.107 (1700.107)

Any ideas? Maybe trouble in Chromium version? Is there any instructions how to build node-webkit with fresh chromium?

@longsleep
Copy link
Author

@longsleep longsleep commented Feb 28, 2014

All right - i am not able to reproduce this with node-webkit 0.9.2. SCTP Data channels work fine with 0.9.2 so i am closing this.

@longsleep longsleep closed this Feb 28, 2014
@longsleep longsleep reopened this Mar 6, 2014
@longsleep
Copy link
Author

@longsleep longsleep commented Mar 6, 2014

@rogerwang: node-webkit can communicate fine with Chrome 32 but not with Chrome 33 or later. This seems to be a Chrome 32 issue. The same issue can be found in Chromium 32.0.1700.77. This is the same version as the Chromium Version in node-webkit 0.9.2 and these too talk fine to each other. But both cannot speak to Chromium 33+. I think that you guys cannot do much about it other than upgrading to Chromium 33 - feel free to keep it open or close it. I was not able to find a workaound to make Chromium 32.0.1700.77 talk to anyone other that itself.

@rogerwang
Copy link
Member

@rogerwang rogerwang commented Mar 7, 2014

@longsleep nw 0.9.2 is updated to Chromium 32.0.1700.107. Does that version have the bug as well?

@longsleep
Copy link
Author

@longsleep longsleep commented Mar 7, 2014

@rogerwang: sorry i meant 32.0.1700.107. The same Version is in Ubuntu too - and it has the same Problem. It is exactly varuzhnikov described above with node-webkit. To test one can install Spreed Speak Freely https://github.com/strukturag/spreed-speakfreely
When installed, join twice and call the other user. Then try to chat when in a call.

@BradDodi
Copy link

@BradDodi BradDodi commented May 27, 2014

Are there any updates for this issue?

As previously said, it's currently impossible to send data using DataChannels to Chromium v33+. Is node-webkit going to be updated soon to a newer Chromium release?

@jure
Copy link

@jure jure commented Jun 21, 2014

👍 got bit by this just today, after spending a few hours trying to figure out why my client refuses to work in node-webkit.

@longsleep
Copy link
Author

@longsleep longsleep commented Jun 21, 2014

This is bug in the Chromium version included with node-webkit 0.9. Try with 0.10.0-rc1 when it is available.

@jure
Copy link

@jure jure commented Jun 21, 2014

Thanks for the update, will do. I'm afraid to embark on the compilation journey myself, so I guess I'll wait :)

@longsleep
Copy link
Author

@longsleep longsleep commented Jun 21, 2014

Since a couple of hours there are automatic builds - check your code with the latest build and report back.

Builds: http://dl.node-webkit.org/live-build/

@longsleep
Copy link
Author

@longsleep longsleep commented Jun 21, 2014

@rogerwang: Live builds are great. http://dl.node-webkit.org/live-build/06-21-2014/linux64_master-build-55-633e3d5-b0d0757-cf7702c-8fb09a0-d54520d-86728d1/ fixes the problem for me. So i am tempted to close this.

@jure: Please let us know if it works for you too.

@longsleep
Copy link
Author

@longsleep longsleep commented Jul 4, 2014

Closing as it works in nw 0.10.

@longsleep longsleep closed this Jul 4, 2014
@jure
Copy link

@jure jure commented Jul 6, 2014

Yes, very sorry for the delay, I also confirm that DataChannels now work as expected. P.S.: Live builds are fantastic!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants