Banner Image

WebRTC Basics

Shivam
September 9, 2021
3 Minutes Read

scroll

down

Banner Image

Looking for other services or solutions?

ux/ui image
Explore our services
IN A nutshell

What is WebRTC?

WebRTC (Web Real Time Communication) enables peer-to-peer communications between browsers or the applications.

IN A nutshell

What’s a signaling server?

To perform signaling, a Signaling Server is used.

IN A nutshell

What is SDP?

SDP stands for Session Description Protocol which is a standard for describing a peer-to-peer connection.

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.

 

What is signaling?

A WebRTC peer connection or simply a connection between two user is established through discovery and negotiation process called Signaling.

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.
What technologies are used for making a signaling server?
Websockets or XMLHttpRequest can be used for signaling server to share info between to users.
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.

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.
 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().

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
 From Where to get ICE Candidates?
    From stun or turn server.

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.

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

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:

0 Shares
Tweet
Share
Share
Pin