peerjs icon indicating copy to clipboard operation
peerjs copied to clipboard

Negotiation of connection to X failed.

Open stevedekorte opened this issue 9 years ago • 8 comments

When I'm not on the same network the other peer, I get a "Negotiation of connection to [peer name] failed." I've tried this on several networks. Neither computer has a static IP and neither network has a firewall. Any suggestions?

stevedekorte avatar May 17 '17 03:05 stevedekorte

Same problem here, any luck?

michaelcamper avatar Nov 18 '18 09:11 michaelcamper

Same problem here. But only on cell network on phone. It works on WIFI and computer, desktop. @stevedekorte have you found the issue?

sharik709 avatar Jan 09 '19 15:01 sharik709

@stevedekorte Same problem for me

mballabaniapr avatar Jan 26 '19 22:01 mballabaniapr

Same problem for me. Any updates?

RamyaAshika avatar Mar 11 '19 09:03 RamyaAshika

Try to use relay server. Please, leave a comment if it doesn't work for you.

afrokick avatar Nov 01 '19 15:11 afrokick

Same issue, on mobile network it did not work for me too. It was working in wifi but not with one peer on wifi and another on 4G network.

Update: As @afrokick suggested the 'relay server' worked for me. Actually its a TURN server which is required which does a packet retransmission via TURN server instead of direct connection like Peer to peer. I actually ended up setting up coturn server in aws EC2 just to test out. It did not work without SSL in coturn, so I created self signed certificate and set up coturn that seemed to work. Not only STUN server alone wont work.

samarjit avatar Oct 06 '21 02:10 samarjit

Hi I'm having a similar issue, it some times happens to me when I'm opening a data channel, it works well for media streams, but sometimes the data channel just wont open, I'm using peerjs-server, I wanted to know if despite being using peerjs-server I should use something like coturn? if someone could point me to the right direction it would be very cool, right now I'm at a loss with this.

eko234 avatar Mar 18 '22 08:03 eko234

Hi, let me share my remarks on this.

Just had the following scenarios: A) two peers are in the same LAN (wifi-based) - all works flawlessly B) the listener in LAN (wifi), the caller in mobile network - does not work (out of the box)

Chrome reported no errors, but FF said "WebRTC: ICE failed, your TURN server appears to be broken, see about:webrtc for more details" which gave me clues where to look for.

Ended up setting up commercial (yet free) TURN service and guess what? It all now works like a dream!

"If direct peer-to-peer connection isn't possible due to firewall or NAT restrictions, the TURN server acts as a relay, facilitating data transfer by relaying media packets between peers" (quoted by GPT); certainly, this is where the cost lays in WebRTC.

Moreover, the (quite decent) PeerJS documentation states in Are there any caveats? point "a small percentage of users are behind symmetric NATs. When two symmetric NAT users try to connect to each other, NAT traversal is impossible and no connection can be made. A workaround is to proxy through the connection through a TURN server. The PeerServer cloud service provides a free TURN server. This will allow your PeerJS app to work seamlessly for this situation".

sharpcoding avatar May 13 '24 17:05 sharpcoding