Updated on 14 Jun, 20268 mins read 13 views

Introduction

At this point, we know:

  • Why WebRTC exists
  • How NAT works
  • Why STUn/TURN works
  • What MediaStreams are
  • What RTCPeerConnection is

However, one enormous mystery still remains.

When you see code like:

const pc = new RTCPeerConnection();

nothing happens.

No call starts.

No audio flows.

No video appears.

Why?

Because creating a PeerConnection is like buying a phone.

Owning a phone does not automatically create a conversation.

Something else must happen.

You must:

  1. Find the other person.
  2. Exchange information.
  3. Agree on communication parameters.
  4. Establish connectivity.
  5. Start Communication

This entire process is called:

Connection Establishment

The Biggest Misconception in WebRTC

Ask a beginner:

How does Alice connect to Bob?

Common answer:

Alice creates RTCPeerConnection
Bob creates RTCPeerConnection
Done

Unfortunately:

Nothing works

Why?

Because Alice and Bob are strangers.

Consider two laptops.

Alice Laptop
Bob Laptop

Questions immediately arise:

Where is Bob?
What codecs does Bob support?
What IP address should I use?
Can bob receive video?
Can bob receive audio?
What encryption method should we use?

The browsers don't know.

There information must be exchanged.

This information exchange is called: Signaling

Understanding Signaling

Before media can flow, peers must communicate.

But here's the paradox.

We need communication before communication exists.

How is that possible?

The answer:

Use another communication channel first.

Analogy: Phone Calls

Imagine Alice wants to call Bob.

Before the conversation begins:

Alice needs:

Bob's Phone Number

Without it:

No Call Possible

Similarly, WebRTC peers need a way to exchange connection information.

What Is signaling?

Signaling is:

The proces of exchanging connection metadata before media communication begins.

Notice something important.

Signaling is NOT media transport.

It does not carry:

Audio
Video

Instead it carries:

Connection Information

What Information Must Be Exchanged?

Let's think like engineers.

What does Alice need to know?

Capability Information

Example:

Alice supports

Buy Me A Coffee

Leave a comment

Your email address will not be published. Required fields are marked *