Deployment Configuration

I deployed my project on my VPS, and it works just as expected.

I attempted to deploy my app locally and globally using Cloudflare’s zero-trust tunnel with the configuration below. The producer state is only connecting and failing when announcedIp is included. However, without announcedIp, the producer state connects, but it only works on the same network. If it’s on a different network, it displays a blank video.

I initially thought it might be blocked by the firewall, so I tried turning it off, but it didn’t work. I’m currently stuck at this point.

const listenInfo = {
	listenInfos: [
		{
			protocol: "udp",
			ip: privateIp, // IPv4,
			announcedIp: ipServer, // this is my domain.site // I assign the port to be random
		},
		{
			protocol: "tcp",
			ip: privateIp, // IPv4,
			announcedIp: ipServer, // this is my domain.site
		},
	],
}

Any thoughts would be appreciated, thank you.

Check that the server ports are reachable from the outside with a simple tool like netcat, etc.

1 Like

I allowed the firewall rule to permit access to ports 40000-49999 for any network, including domains. I even disabled my firewall to check for any differences, but nothing changed.

I assume that if a consumer successfully consumes a producer, it has succeeded in connecting to the port.

  mediasoup:Worker worker process running [pid:12672] +268ms
  mediasoup:Worker createWebRtcServer() +2ms
  mediasoup:Channel request succeeded [method:WORKER_CREATE_WEBRTCSERVER, id:1] +70ms
  mediasoup:WebRtcServer constructor() +0ms
  mediasoup:Worker createRouter() +34s
  mediasoup:Channel request succeeded [method:WORKER_CREATE_ROUTER, id:2] +34s
  mediasoup:Router constructor() +0ms
  mediasoup:Router createWebRtcTransport() +307ms
  mediasoup:Channel request succeeded [method:ROUTER_CREATE_WEBRTCTRANSPORT_WITH_SERVER, id:3] +311ms
  mediasoup:Transport constructor() +0ms
  mediasoup:WebRtcTransport constructor() +0ms
  mediasoup:Transport setMaxIncomingBitrate() [bitrate:1000000] +3ms
  mediasoup:Transport setMaxOutgoingBitrate() [bitrate:1000000] +1ms
  mediasoup:Channel request succeeded [method:TRANSPORT_SET_MAX_INCOMING_BITRATE, id:4] +13ms
  mediasoup:Channel request succeeded [method:TRANSPORT_SET_MAX_OUTGOING_BITRATE, id:5] +2ms
  mediasoup:WebRtcTransport connect() +119ms
  mediasoup:Channel request succeeded [method:WEBRTCTRANSPORT_CONNECT, id:6] +113ms
  mediasoup:Transport produce() +225ms
  mediasoup:Channel request succeeded [method:TRANSPORT_PRODUCE, id:7] +109ms
  mediasoup:Producer constructor() +0ms
  mediasoup:Transport produce() +265ms
  mediasoup:Channel request succeeded [method:TRANSPORT_PRODUCE, id:8] +267ms
  mediasoup:Producer constructor() +266ms
  mediasoup:Router createWebRtcTransport() +11s
  mediasoup:Channel request succeeded [method:ROUTER_CREATE_WEBRTCTRANSPORT_WITH_SERVER, id:9] +11s
  mediasoup:Transport constructor() +11s
  mediasoup:WebRtcTransport constructor() +11s
  mediasoup:Transport setMaxIncomingBitrate() [bitrate:1000000] +1ms
  mediasoup:Transport setMaxOutgoingBitrate() [bitrate:1000000] +1ms
  mediasoup:Channel request succeeded [method:TRANSPORT_SET_MAX_INCOMING_BITRATE, id:10] +4ms
  mediasoup:Channel request succeeded [method:TRANSPORT_SET_MAX_OUTGOING_BITRATE, id:11] +1ms
  mediasoup:WebRtcTransport connect() +21ms
  mediasoup:Channel request succeeded [method:WEBRTCTRANSPORT_CONNECT, id:12] +20ms
  mediasoup:Transport produce() +37ms
  mediasoup:Channel request succeeded [method:TRANSPORT_PRODUCE, id:13] +17ms
  mediasoup:Producer constructor() +11s
  mediasoup:Transport produce() +84ms
  mediasoup:Channel request succeeded [method:TRANSPORT_PRODUCE, id:14] +84ms
  mediasoup:Producer constructor() +85ms
  mediasoup:Router createWebRtcTransport() +172ms
  mediasoup:Router createWebRtcTransport() +1ms
  mediasoup:Channel request succeeded [method:ROUTER_CREATE_WEBRTCTRANSPORT_WITH_SERVER, id:15] +48ms
  mediasoup:Transport constructor() +51ms
  mediasoup:WebRtcTransport constructor() +153ms
  mediasoup:Transport setMaxIncomingBitrate() [bitrate:1000000] +1ms
  mediasoup:Transport setMaxOutgoingBitrate() [bitrate:1000000] +1ms
  mediasoup:Channel request succeeded [method:ROUTER_CREATE_WEBRTCTRANSPORT_WITH_SERVER, id:16] +4ms
  mediasoup:Transport constructor() +2ms
  mediasoup:WebRtcTransport constructor() +3ms
  mediasoup:Transport setMaxIncomingBitrate() [bitrate:1000000] +1ms
  mediasoup:Transport setMaxOutgoingBitrate() [bitrate:1000000] +0ms
  mediasoup:Channel request succeeded [method:TRANSPORT_SET_MAX_INCOMING_BITRATE, id:17] +3ms
  mediasoup:Channel request succeeded [method:TRANSPORT_SET_MAX_OUTGOING_BITRATE, id:18] +1ms
  mediasoup:Channel request succeeded [method:TRANSPORT_SET_MAX_INCOMING_BITRATE, id:19] +0ms
  mediasoup:Channel request succeeded [method:TRANSPORT_SET_MAX_OUTGOING_BITRATE, id:20] +1ms
  mediasoup:Router createWebRtcTransport() +60ms
  mediasoup:Channel request succeeded [method:ROUTER_CREATE_WEBRTCTRANSPORT_WITH_SERVER, id:21] +51ms
  mediasoup:Transport constructor() +55ms
  mediasoup:WebRtcTransport constructor() +56ms
  mediasoup:Transport setMaxIncomingBitrate() [bitrate:1000000] +1ms
  mediasoup:Transport setMaxOutgoingBitrate() [bitrate:1000000] +0ms
  mediasoup:Channel request succeeded [method:TRANSPORT_SET_MAX_INCOMING_BITRATE, id:22] +3ms
  mediasoup:Channel request succeeded [method:TRANSPORT_SET_MAX_OUTGOING_BITRATE, id:23] +0ms
  mediasoup:Transport consume() +30ms
  mediasoup:Channel request succeeded [method:TRANSPORT_CONSUME, id:24] +34ms
  mediasoup:Consumer constructor() +0ms
  mediasoup:Transport consume() +26ms
  mediasoup:Channel request succeeded [method:TRANSPORT_CONSUME, id:25] +26ms
  mediasoup:Consumer constructor() +27ms
  mediasoup:Router createWebRtcTransport() +142ms
  mediasoup:Channel request succeeded [method:ROUTER_CREATE_WEBRTCTRANSPORT_WITH_SERVER, id:26] +79ms
  mediasoup:Transport constructor() +85ms
  mediasoup:WebRtcTransport constructor() +143ms
  mediasoup:Transport setMaxIncomingBitrate() [bitrate:1000000] +2ms
  mediasoup:Transport setMaxOutgoingBitrate() [bitrate:1000000] +1ms
  mediasoup:WebRtcTransport connect() +5ms
  mediasoup:Consumer resume() +86ms
  mediasoup:Channel request succeeded [method:TRANSPORT_SET_MAX_INCOMING_BITRATE, id:27] +10ms
  mediasoup:Channel request succeeded [method:TRANSPORT_SET_MAX_OUTGOING_BITRATE, id:28] +1ms
  mediasoup:Channel request succeeded [method:WEBRTCTRANSPORT_CONNECT, id:29] +1ms
  mediasoup:Channel request succeeded [method:CONSUMER_RESUME, id:30] +1ms
  mediasoup:WebRtcTransport connect() +34ms
  mediasoup:Channel request succeeded [method:WEBRTCTRANSPORT_CONNECT, id:31] +30ms
  mediasoup:Consumer resume() +47ms
  mediasoup:Channel request succeeded [method:CONSUMER_RESUME, id:32] +14ms
  mediasoup:Transport consume() +149ms
  mediasoup:Channel request succeeded [method:TRANSPORT_CONSUME, id:33] +99ms
  mediasoup:Consumer constructor() +101ms
  mediasoup:Transport consume() +1s
  mediasoup:Channel request succeeded [method:TRANSPORT_CONSUME, id:34] +1s
  mediasoup:Consumer constructor() +1s
  mediasoup:WebRtcTransport connect() +2s
  mediasoup:Consumer resume() +308ms
  mediasoup:Channel request succeeded [method:WEBRTCTRANSPORT_CONNECT, id:35] +310ms
  mediasoup:Channel request succeeded [method:CONSUMER_RESUME, id:36] +1ms
  mediasoup:WebRtcTransport connect() +98ms
  mediasoup:Consumer resume() +97ms
  mediasoup:Channel request succeeded [method:WEBRTCTRANSPORT_CONNECT, id:37] +96ms
  mediasoup:Channel request succeeded [method:CONSUMER_RESUME, id:38] +1ms

As I search through this forum, I think it can’t use the CNAME DNS type. Therefore, the producer won’t connect, probably.
I’m not really sure about this though.

Wrong, all this is just the signaling.

1 Like

Thank you for clarifying that for me. Let’s assume this problem lies with the DNS configuration on my side.

I have another question. I tested my app on the same network but different devices (computer, laptop, and mobile phone), and the video lags every 5 seconds. I wonder if this is related to my configuration or something else. I want my app to lag as little as possible.

My app uses one transport per client. For example, if there are 5 users in a room, each user will have one transport producer and 8 transports (audio and video consumers). My app creates one router per room.

I built my app based on the documentation step by step, but the video still lags even on the same network but different devices.

Please provide some insight. If you need more information from my code, please let me know.