feross / simple-peer

📡 Simple WebRTC video, voice, and data channels
MIT License
7.44k stars 975 forks source link

ERROR DOMException: Cannot set local answer when createAnswer has not been called. #842

Closed madrigal1 closed 3 years ago

madrigal1 commented 3 years ago

What version of this package are you using? Version "^9.11.0" What operating system, Node.js, and npm version? Manjaro node -12.8.3 npm -7.9.1

What happened? The above error occurs with almost no way to properly debug. no similar issues after searching on google and issue tracker

image

What did you expect to happen?

Are you willing to submit a pull request to fix this bug? no

madrigal1 commented 3 years ago

Solution to this error:

There are two different types of signal to be sent via websockets:

  1. signal from the initiator peer to all other peers (type:offer)
  2. signal from the peer back to the intiator (type:answer) error pops up if you accidently send the first signal back to the initiator instead of the second signal type