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.

Infinite loop sending renegotiate: true

See original GitHub issue

I think this is more a question than an actual issue. In the strange case where both peers are created with initiator: false, they will get in the loop of sending to each other a signal with {renegotiate: true}.

My question is: could/should simple peer handle this case or should it fall down to the app? Thanks.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
salwa1234commented, Aug 25, 2020

hi, i am trying to develop a video chat application using react js and node i have used simple-peer npm package , but the problem is when i try to signal an incoming signal it is causing a loop . here is my code,

const addPeer = (data, stream) => { console.log(‘add’)

const peer = new Peer({
  initiator: false,
  trickle: false,
  stream
});

peer.on('signal', signal => {
  console.log('again')
  socket.emit("make-answer", {
    signal,
    user: user,
    to: data.senderSocket
  });
});


peer.signal(data.signal);
return peer;

};

when peer.signal fired then peer.on handler runs twice can any one help?

1reaction
t-mullencommented, Oct 2, 2018

A connection can’t be established unless one peer is an initiator.

As for preventing an infinite loop, it should be an easy fix (non-initiators should ignore the {renegotiate: true} message. Will PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Infinite loops and break · CodeCraft-Python - BuzzCoder
This means that i < 10 will always be true and the loop will never end. This is called an infinite loop, which...
Read more >
Why do my async functions get stuck in infinite loop?
I'm trying to setup some functions to continuously fetch and send data back and forth. However, after sending ...
Read more >
Infinite loop - Wikipedia
In computer programming, an infinite loop (or endless loop) is a sequence of instructions that, as written, will continue endlessly, unless an external ......
Read more >
How to solve "Infinite Email" Loops - ServiceNow - Now Support
An "infinite email" loop occurs when an update to a record triggers a notification that sends an email to an external recipient.
Read more >
is boost mobile down
Get balance and usage info in real time. ... The "customer service" phone is a continuous loop of menus with no access to...
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