When Trickle ICE is enabled, I get the following error when trying to establish a peer connection between two Chrome browsers on the same machine:
Failed to set remote answer sdp: Called in wrong state: STATE_INPROGRESS
Disabling Trickle ICE, everything works smoothly.
The code I'm testing with is in a gist: https://gist.github.com/adammw/d9bf021c395835427aa0
What version of node, simple-peer, and which browser are you using? Your example works fine for me.
Make sure you're using the latest simple-peer, version 5.11.3.
Btw, you shouldn't add a new set of event listeners in socket.on('receivePeerSignal', function(data) { because that will get called multiple times with each bit of signaling data and you'll end up handling the 'connec't and 'data' events multiple times.
I'm closing this, as I can't reproduce it. It works for me. If you have new information you can provide to help narrow this down, please comment or open a new issue. Thanks!
@feross yep, I believe my mis-signalling was to blame here. thanks!
For reference I've updated my gist and and confirm it works correctly.
Thanks that actually helped save me on another project I was working on :)
Most helpful comment
Btw, you shouldn't add a new set of event listeners in
socket.on('receivePeerSignal', function(data) {because that will get called multiple times with each bit of signaling data and you'll end up handling the 'connec't and 'data' events multiple times.