My janus server was deployed on the public network, and I opened two video call pages in the same browser on the same computer. I found that “STUN requests sent/responses received” were found in webrtc-internals, and the local candidate was the relay type. Even if I deploy the janus server on the LAN and do not configure a dedicated coturn server, both peers are on the LAN and will use Google’s stun/turn server.
I’m confused, isn’t communication within the same LAN done without a stun/turn server? Because there is no need to penetrate NAT and firewall between them.
ICE is mandatory for WebRTC. It has nothing to do with using a STUN server, if that’s what you’re asking. The fact you see Google’s STUN server being used is probably because janus.js defaults to it.
It is said:“two peers on the same Local Area Network (LAN) can communicate directly without the need for the ICE (Interactive Connectivity Establishment) process. When two peers are on the same LAN, they can typically discover and communicate with each other using local network protocols such as IP addressing and socket communication.”
But I don’t understand why I have to use a stun/turn server when I use janus
I just said you don’t. ICE and “using a STUN server” are not the same thing.
You may want do study a bit more in detail how WebRTC works, to better understand the requirements of the technology: ICE is a mandatory requirement, and a foundation of WebRTC.
Thank you Iorenzo!
I misstated earlier that if I have two users talking on the same LAN, it will use Google’s stun/turn server even if it does not have a dedicated stun/turn server. And you might see stun bingding request and turn allocate request (webrtc-internals sometimes sees stun bingding request error and turn allocate request request error).
In addition,you said that " ICE is a mandatory requirement, and a foundation of WebRTC.", even if two peers are on the same LAN, the ICE process is required? This is different from what I saw in a webrtc tutorial.
It is said that:
“While ICE is considered a fundamental aspect of WebRTC, there are certain scenarios where it may not be needed or can be bypassed. Here are a few cases where ICE might not be required:
Local network communication: If two devices are on the same local network, without any intervening firewalls or NAT devices, they can often communicate directly without the need for ICE. In such cases, ICE may not be necessary to establish a connection.”