Blog

WebRTC Basics

Shivam- September 9, 2021

WebRTC

1. What is WebRTC?

WebRTC (Web Real Time Communication) enables peer-to-peer communications between browsers or the applications. In other words, WebRTC allows user to exchange their media (audio, video and data) through the web without any plugin or framework.

Application which are using WebRTC:

  • Google Meets
  • Jetsi
  • Discord
  • FB messenger etc.
2. What is signaling?
A WebRTC peer connection or simply a connection between two user is established through discovery and negotiation process called Signaling.
3. What’s a signaling server?
To perform signaling, a Signaling Server is used. Through this signaling server, the two peers (users) can locate one another, and exchange necessary information which are required to establish direct connection.
4. What technologies are used for making a signaling server?
Websockets or XMLHttpRequest can be used for signaling server to share info between to users.
5. What kind of necessary data are shared by the users/peers?
Generally a signaling server requires 5 kinds of data:
        – SDP
        – ICE Candidate
        – Caller (Host) name
        – Offer-type (or req. type)
        – Target user (Calle)
But its not limited to only these five kinds of data. Signaling server can ask for any kind of data it requires but these five data are must required in order to set up a connection.
6. What is SDP?
SDP stands for Session Description Protocol which is a standard for describing a peer-to-peer connection. SDP contains the codec, source address, and timing information of audio and video.
7. From where to get SDP data of users or How to create a SDP data?
User RTCPeerConnection.createOffer() to create a offer and then send this offer to signaling server.
Calle or reporter will respond to this offer with RTCPeerConnection.createAnswer().
8. What is ICE Candidate?
ICE (Interactive Connectivity Establishment) allows the users/peers to discover enough information about their topologies to potentially find one or more paths by which they can establish a data session. Its a techniques used in NAT( network address translator ) for establishing communication for VoIP, peer-peer, instant messaging and other kind of interactive media. Typically ice candidate provides the information about the IP-address and port from where the data is going to be exchanged.
    Learn More about ICE candidate:
    2. MDN
9. From Where to get ICE Candidates?
    From stun or turn server.
10. What is a Stun Server?
Session Traversal Utilities for NAT (STUN)  is a protocol to discover your public address and determine any restrictions in your router that would prevent a direct connection with a peer.
11. What is a turn server?
Some routers using NAT employ a restriction called ‘Symmetric NAT’. This means the router will only accept connections from peers you’ve previously connected to. Traversal Using Relays around NAT (TURN) is meant to bypass the Symmetric NAT restriction by opening a connection with a TURN server and relaying all information through that server.
11. When to use stun server and when to use turn server?
Most of the time stun server will be used to get ICE candidates but some times when stun server will fail to get ICE Candidates then Turn server is used.
12. How WebRTC works?
1.png
  • Caller will create an WebRTC offer which will contain his name, target user, offer type and his SDP. Then he sends it to signaling server. Signaling server will get that offer and sends it to Calle or  target user. Until a response is received from Calle, Caller will get ICE candidate from stun or turn server and sends it to signaling server.
  • Calle will respond to the offer with an answer which will contain her SDP, name, Caller who called, and answer type. After sending data calle also starts to send her ICE candidates to signaling server.
  • After getting each others ICE candidates video and audio can be shared.

Read More About WebRTC:

Back to Listing

Similar Artcles

WebRTC Basics
read more
Rule-Based AI Vs. Machine Learning: Which One Is Best For Your Enterprise
read more
Investments In Employee Training And Their Long Term Impact On The Organization
read more