simple-peer: Error: Ice connection failed
Pinned Troubleshooting
This error is caused by a failure to find a viable network route through ICE. The following steps will help you debug common causes of the error.
- You have found a bug that is already patched in simple-peer source.
- Try the latest source code for simple-peer (not the latest npm release).
- Your STUN or TURN servers are not configured properly.
- Ensure you can connect to your STUN/TURN servers with this tool: https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/
- Ensure you receive at least one relay candidate (from the TURN server).
- Make sure you are using
urls
and noturl
in theiceServers
config. - You specified a
config
object with noiceServers
. - Try using your own STUN servers instead of default/public ones (which can be unreliable).
- There is a problem with your signalling channel.
- Ensure latency on signalling messages is not too high (above 10 seconds).
- Ensure all signal messages are being delivered.
- Your firewall or internet provider is blocking WebRTC traffic.
- Try disabling your firewall first, if it works, test the following:
- Append “?transport=tcp” to your TURN config to avoid UDP rules.
- Configure your TURN server to use port 443 to avoid port rules.
- Use TLS over TCP to avoid packet analysis rules.
- You WILL NOT need to disable firewalls in production.
- You have found a new bug, or a rare case we haven’t discussed here.
- Opening a NEW issue, mentioning you’ve completed the above steps, and providing a link to a relatively brief and filtered .pcap file is the only way anyone can help you further. https://webrtc.org/testing/wireshark/
Original Issue
Hi, I am trying to make a connection with simple-peer. One side is on node & other side is on chrome. Normally everything is OK. But When one side is switch to phone internet I get “Error: Ice connection failed” error. I have a turn server & using for iceServer config. Any idea how to fix or debug that?
Thanks.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 58
Hi all In my case one side is on browser and the other side is on nodejs. I have my own turn-stun server installed which is online. l forced simple-peer to work with only relay mode then it works on symmetric-nat. But in this mode l can not work with unsymmetric-nat. I also think this is problem of simple-peer.
I could not find a solution yet.
I can not make the Simple Peer to connect. It shows me the above-mentioned error. Is it because we use Simple-Peer? I suspect, this error was created during the new releases. Moreover, even the Simple-Peer Demo source code cannot work on two different computers from two different networks. I tried all the above suggestions, and absolutely none of them worked for me. I tried dozens of iceServers as well. Any suggestions of how you made it work? You can check my application on my website
The error I receive
I can make it only working on localhost (multiple tabs) and in a local network (different computers), but in the same local network. In the local network, I was able to connect between local computers and local browsers from Chrome, Firefox.
The signals look ok for me. Moreover, when the connection is trying to establish, the Ice connection fail error appears on both browsers, so somehow the connection is being initialized, but then it throws the above-mentioned exception.
I have been using this library and it’s working fine. As per the WebRTC handshake you need to have TURN not just STUN servers set up and working right.
I am using the turn servers with https://xirsys.com/
var p = new Peer({initiator: location.hash != “#visit”, trickle: false, stream: stream, iceTransportPolicy: ‘relay’, reconnectTimer: 3000, config : { iceServers: JSON.parse(ice_servers)}});
Issues like this really scare away people trying to work with WebRTC. Users should not have to turn off their firewall just to use a service in their browsers.
To all the silly geese who don’t read properly (of which I’m one), make sure you paste the “answer” back into the initiator when running the code from the README.md.
Failing to do this will result in this same error after the timeout.
Here’s the minimal demo I’ve been using to reproduce if anyone is interested in helping with this issue. (You can use https://rabb.it to get a symmetric NAT peer).
https://codepen.io/RationalCoding/pen/bYEmjw?editors=0011