Error Codes Wiki

WebRTC Connection Errors — ICE Failed, STUN/TURN, and Peer Connection Issues

Errorweb development

About WebRTC Connection Errors

Fix WebRTC connection errors including ICE connection failed, STUN/TURN server issues, NAT traversal failures, and peer-to-peer video call disconnections. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.

Here are the key things to understand: WebRTC enables peer-to-peer audio, video, and data communication directly between browsers. ICE (Interactive Connectivity Establishment) finds the best path between peers. STUN servers help discover your public IP; TURN servers relay traffic when direct connection fails. Corporate firewalls and strict NATs can block WebRTC peer connections. ICE connection state progression: new > checking > connected > completed (or failed/disconnected). Understanding these fundamentals will help you diagnose and resolve this issue more effectively.

The most common reasons this occurs include: Both peers behind symmetric NAT without a TURN relay server. Corporate firewall blocking UDP traffic on non-standard ports. STUN server unreachable or returning incorrect candidate information. TURN server credentials expired or server at capacity. Browser VPN extension routing traffic through a path that breaks WebRTC. Identifying the root cause is the first step toward finding the right solution.

To resolve this, follow these recommended steps: Check WebRTC connection state: monitor RTCPeerConnection.iceConnectionState in DevTools console. Verify STUN/TURN servers: test with trickle-ice.nicedandy.com to see if candidates are gathered. Ensure a TURN server is configured for fallback: ICEServer config should include both STUN and TURN. Allow UDP traffic: WebRTC prefers UDP; ensure firewall allows UDP on ports used by TURN (typically 443 or 3478). Try TURN over TCP/443 as a fallback for restrictive firewalls (mimics HTTPS traffic). Disable browser VPN extensions that may interfere with WebRTC ICE candidate gathering. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.

This article is part of our Browser Errors collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.

Quick Answer

What is the difference between STUN and TURN?

STUN helps discover your public IP for direct peer connection (free, low bandwidth). TURN relays all traffic through the server when direct connection fails (expensive, high bandwidth). Most calls use STUN; TURN is the fallback.

Overview

Fix WebRTC connection errors including ICE connection failed, STUN/TURN server issues, NAT traversal failures, and peer-to-peer video call disconnections.

Key Details

  • WebRTC enables peer-to-peer audio, video, and data communication directly between browsers
  • ICE (Interactive Connectivity Establishment) finds the best path between peers
  • STUN servers help discover your public IP; TURN servers relay traffic when direct connection fails
  • Corporate firewalls and strict NATs can block WebRTC peer connections
  • ICE connection state progression: new > checking > connected > completed (or failed/disconnected)

Common Causes

  • Both peers behind symmetric NAT without a TURN relay server
  • Corporate firewall blocking UDP traffic on non-standard ports
  • STUN server unreachable or returning incorrect candidate information
  • TURN server credentials expired or server at capacity
  • Browser VPN extension routing traffic through a path that breaks WebRTC

Steps

  1. 1Check WebRTC connection state: monitor RTCPeerConnection.iceConnectionState in DevTools console
  2. 2Verify STUN/TURN servers: test with trickle-ice.nicedandy.com to see if candidates are gathered
  3. 3Ensure a TURN server is configured for fallback: ICEServer config should include both STUN and TURN
  4. 4Allow UDP traffic: WebRTC prefers UDP; ensure firewall allows UDP on ports used by TURN (typically 443 or 3478)
  5. 5Try TURN over TCP/443 as a fallback for restrictive firewalls (mimics HTTPS traffic)
  6. 6Disable browser VPN extensions that may interfere with WebRTC ICE candidate gathering

Tags

webrtcicestunturnpeer-connection

More in Web Development

Frequently Asked Questions

STUN helps discover your public IP for direct peer connection (free, low bandwidth). TURN relays all traffic through the server when direct connection fails (expensive, high bandwidth). Most calls use STUN; TURN is the fallback.