From b3dde85cd2e83735ca1cb1f27e192795564e2ba6 Mon Sep 17 00:00:00 2001 From: Bas van den Aakster Date: Sat, 6 Dec 2025 13:49:52 +0100 Subject: [PATCH] Force TURN relay mode to bypass NAT hairpinning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added iceTransportPolicy: 'relay' to RTC_CONFIG to force TURN relay usage. This bypasses NAT hairpinning issues when testing on the same network (e.g., two browser tabs on the same machine). This setting ensures maximum compatibility and reliability for WebRTC connections by always using the TURN relay instead of attempting direct or STUN-based connections. Note: Should be commented out in production to allow direct connections when possible for better performance. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- src/App.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/App.jsx b/src/App.jsx index 0c15dd3..878042c 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -15,7 +15,10 @@ const RTC_CONFIG = { username: "webrtcuser", credential: "supersecretpassword" } - ] + ], + // Force TURN relay to bypass NAT hairpinning (when testing on same network) + // Comment out for production to allow direct connections when possible + iceTransportPolicy: 'relay' }; export default function App() {