2

The app: I'm developing app that allows peers to connect to each other, I use mediasoup and WebRTC (SFU).

The problem: Everything works locally but when deployed to VPS (I use Vultr) peers can not connect. On VPS firewall ports are open for the range declared in mediasoup (tcp and udp).

I went through several questions here on stackoverflow but unfortunatelly none of it helps:

I use metered.ca, and I pass configuration on the client side:

producerTransportRef.current = deviceRef.current.createSendTransport({
                ...params,
                iceServers: [
                    {
                        urls: 'stun:stun.relay.metered.ca:80',
                    },
                    {
                        urls: 'turn:a.relay.metered.ca:80',
                        username: 'XXX',
                        credential: 'YYY',
                    },
                    {
                        urls: 'turn:a.relay.metered.ca:80?transport=tcp',
                        username: 'XXX',
                        credential: 'YYY',
                    },
                    {
                        urls: 'turn:a.relay.metered.ca:443',
                        username: 'XXX',
                        credential: 'YYY',
                    },
                    {
                        urls: 'turn:a.relay.metered.ca:443?transport=tcp',
                        username: 'XXX',
                        credential: 'YYY',
                    },
                ],
            });

params come from the server from defining mediasoup transport and are passed to the frontend where are merged with TURN server configs:

let transport = await router.createWebRtcTransport(webRtcTransport_options);
callback({
                // https://mediasoup.org/documentation/v3/mediasoup-client/api/#TransportOptions
                params: {
                    id: transport.id,
                    iceParameters: transport.iceParameters,
                    iceCandidates: transport.iceCandidates,
                    dtlsParameters: transport.dtlsParameters,
                },
            });

When I print the iceCandidate I get from the server there's my server ip address enter image description here

When I run webrtc-internals in chrome I get: enter image description here

I followed the error code:

701 error code - If no host candidate can reach the server, errorCode will be set to the value 701 which is outside the STUN error code range.

I noticed that the host candidate is in my local network (not sure if that's the problem)

I'd highly appreciate even suggestions on what to check next

eso32
  • 45
  • 5
  • I have a same issue using Chrome. Another browsers on the same environment and network (Firefox for instance) were able to connect to the TURN server and establish a proper p2p connection. – Northern Poet Aug 04 '23 at 05:31

0 Answers0