question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ICE gathering lasts 39-40 second in Electron application

See original GitHub issue

I have simple hello-world application, which is builded by https://electronforge.io/

This application just creates Peer with simple-peer, like this:

var Peer = require('simple-peer')

function createClientPeer(onSignal) {
  var clientPeer = new Peer({
    initiator: true,
    trickle: false , // also I tried true
    config: { iceServers: [{ urls: 'stun:stun.l.google.com:19302' }] },
  });

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

  clientPeer.on('signal', function (data) {
    let jsonData = JSON.stringify(data);
    console.log('SIGNAL', jsonData);
    onSignal(jsonData);
  });

  clientPeer.on('connect', function () {
    console.log('CONNECT');
    clientPeer.send('whatever' + Math.random());
  });

  clientPeer.on('data', function (data) {
    console.log('data: ', String.fromCharCode.apply(null, data));
  });

  return clientPeer;
}

And I try to create Peer like this:

  var clientPeer = createClientPeer(function (clientOffer) {
    console.log("createClientPeer", clientOffer);
  });

I have problem. I don’t get event about signal for 39-40 second (after that I get successful event and connection becomes ready for use).

I turned on logging and found out, where there is a pause:

\simple-peer\index.js:28 [Sun, 04 Nov 2018 21:10:26 GMT] _needsNegotiation
\simple-peer\index.js:28 [Sun, 04 Nov 2018 21:10:26 GMT] starting batched negotiation
\simple-peer\index.js:28 [Sun, 04 Nov 2018 21:10:26 GMT] start negotiation
\simple-peer\index.js:26 [Sun, 04 Nov 2018 21:10:26 GMT] signalingStateChange have-local-offer
\simple-peer\index.js:28 [Sun, 04 Nov 2018 21:10:26 GMT] createOffer success
\simple-peer\index.js:26 [Sun, 04 Nov 2018 21:10:26 GMT] iceStateChange (connection: new) (gathering: gathering)
\simple-peer\index.js:26 [Sun, 04 Nov 2018 21:11:05 GMT] iceStateChange (connection: new) (gathering: complete)
\simple-peer\index.js:28 [Sun, 04 Nov 2018 21:11:05 GMT] signal
webrtc-client.js? [sm]:18 createClientPeer2 Mon Nov 05 2018 00:11:05 GMT+0300 (Russia TZ 2 Standard Time)
webrtc-client.js? [sm]:20 SIGNAL {"type":"offer","sdp":"v=0\r\no=- 7804354501182328042 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE data\r\na=msid-semantic: WMS\r\nm=application 61312 

So, you can see, that there is 40 seconds duration between iceStateChange (connection: new) (gathering: gathering) and iceStateChange (connection: new) (gathering: complete).

It seems, that this is a Electron-specific problem. But I cannot understand, what is going wrong.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
t-mullencommented, Nov 4, 2018

Try the source version of simple-peer, we recently added a timeout to ice completion that might help here. You’ll want to set trickle to false.

0reactions
Hixon10commented, Nov 5, 2018

@t-mullen ok, thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

H2 - Groups and Classes - MN.gov
The first two digits of the code number identify the group, and the last two digits of the code number identify the classes...
Read more >
Program of the 24th Annual Meeting of the Electron ...
On a Philips EM-2oo, at 80 kV, two-second exposures were used at X141000 magnification. ... 3922 24TH ANNUAL MEETING· ELECTRON MICROSCOPY SOCIETY OF...
Read more >
Hybrid-Electric Propulsion Systems for Small Unmanned Aircraft
The missions performed by unmanned aerial vehicles (UAV) mainly have the objective to gather and distribute information. The applications and payloads are.
Read more >
Perturbed mitochondria–ER contacts in live neurons ... - NCBI
We performed dynamic and ultrastructural analysis of hippocampal neurons from wild-type (WT) and McGill-R-Thy1-APP transgenic rats, using multicolor live ...
Read more >
Durable Polylactic Acid (PLA)-Based Sustainable Engineered ...
The paper comprehensively reviews durable polylactic acid (PLA)-based engineered blends and biocomposites supporting a low carbon economy.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found