webrtcnat-traversalkurentoice-protocol

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?


Solution

  • 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.