Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is ICE Necessary for Client-Server WebRTC Applications?

I have a WebRTC MCU (kurento) running on a public IP address serving some clients that only send or only receive audio So every clients is directly connected with MCU (not with each other ) that has a public IP address .

Q1: Is there still a necessity to use STUN and TURN for NAT traversal ?? if so Why ??
Q2: Is there any hack in WebRTC in browser that would remove the need for STUN and TURN ?

In my opinion : most of client-server architectures do not have any difficulty with clients behind NAT .What's the difference here with webrtc?

like image 375
Geak RN Avatar asked Aug 30 '15 21:08

Geak RN


People also ask

Do I need a STUN server for WebRTC?

More generally, no, a STUN server is not strictly required. I know this because I successfully connected 2 WebRTC peers without a stun server.

What are ICE servers in WebRTC?

Interactive Connectivity Establishment (ICE) is a framework to allow your web browser to connect with peers. There are many reasons why a straight up connection from Peer A to Peer B won't work.

Is WebRTC a client server?

You can use WebRTC with a node server, but WebRTC is really a protocol for persistent communication between two clients. Using socketIO will set up a persistent connection between a client and your server. You might want to look into PeerJS if you are interested in setting up WebRTC handshaking from your node server.


2 Answers

Yes ICE is absolutely must for WebRTC.

Q1: Is there still a necessity to use STUN and TURN for NAT traversal ?? if so Why ??

For your scenario you don't need to use STUN or TURN. Let me explain why.

Every client that are in private network is under some kind of NAT which has a public IP address. Outside world doesn't know this client's private IP address and even if they knew they can't connect with the client without knowing that public IP address. STUN server is used to gather this public IP address.

So if your server wants to initiates the connection then it needs the client to send its NAT's public IP. Client will use STUN server to know its public IP and send it to the server. But if client initiates the connection then there is no need to know the NAT's public IP. Client can send packets to the public server to initiate the connection. Server can know the cilents public IP from the clients packet and then they can connect. So no need for STUN.

Your server is doing TURN's role in this scenario. So you don't need TURN server.

Q2: Is there any hack in WebRTC in browser that would remove the need for STUN and TURN ?

There is no hack. Depending on scenarios TURN/STUN is used. For your scenario you don't need. If you wanted to make client-client connection then you would have needed STUN server.

like image 100
Tahlil Avatar answered Oct 05 '22 13:10

Tahlil


  • ICE is mandatory
  • but using any stun and turn server is not.
  • since you are connecting to a server on a public port, you NEVER need to use a TURN server, but depending the kind of NAT/Firewall your clients are behind, you might need a STUN server
  • you do not need to modify the browsers at all. The application decides wether to use a stun server or not. if you pass an empty "iceservers" parameter to your peerconnection object at creation, the ICE UA in your browser will only generate host (local) candidates.
like image 28
Dr. Alex Gouaillard Avatar answered Oct 05 '22 13:10

Dr. Alex Gouaillard