plain-hamburger-12701
03/04/2026, 5:41 PMtall-airline-16756
03/04/2026, 5:41 PMtall-airline-16756
03/04/2026, 5:42 PMlivekit-client@v2.15.13 to use TCP only from the browser.
You can force TCP-only WebRTC connectivity by telling the browser to use only relay candidates (i.e., TURN) when creating the PeerConnection. Set iceTransportPolicy: 'relay' via the rtcConfig option when calling `room.connect()`:
import { Room } from 'livekit-client';
const room = new Room();
await room.connect(
'<wss://your-livekit-server.com>',
'your-access-token',
{
rtcConfig: {
iceTransportPolicy: 'relay', // forces use of TURN (TCP/TLS) only
},
}
);
Why this works
• iceTransportPolicy: 'relay' prevents direct host/srflx (UDP) candidates and forces the peer connection to use TURN relays. TURN servers reachable over TCP/TLS (typically on port 443) will provide TCP-based connectivity that works through restrictive firewalls.
Important notes
• You must have a TURN server configured that supports TURN over TCP/TLS (port 443). If the TURN server only provides UDP, the connection will fail.
• Ensuring your LiveKit server / media node exposes TURN/TLS is required so clients can establish TCP/TLS relayed media.
• This setting applies to browser WebRTC behavior — it does not change any server-side transport behavior.
If you’d like, tell me:
• whether you already have TURN/TLS configured on your LiveKit deployment (hostname/port), and
• whether you’re seeing failed connections now (any browser console logs or SDP/ICE debug output).
I can then help verify your TURN configuration or walk through debugging steps.
Sources: Firewall Tips for LiveKit Connectivity | LiveKit | Diagnosing Connection Errors with the Connection Test Utility | LiveKit