Coding on WebRTC technology?

One
6 min readFeb 19, 2023

--

WebRTC is used for peer-to-peer communication in browsers. However, it is now widely used in multilateral practices with one-to-many or many-to-many participants. Also, to use WebRTC in such a project, you most likely need WebRTC servers.

Whatever you are developing with WebRTC, you should know what a WebRTC server is and what it is used for. This makes your job very easy.

In this detailed post, we will introduce WebRTC servers and new concepts such as Multipoint Conferencing Unit (MCU), Selective Forwarding Unit (SFU), transcoding, and simulcasting, and we’ll explain how to use a free WebRTC server.

Let’s start with the definition of WebRTC and continue with the question of what is WebRTC server.

What is WebRTC?

WebRTC stands for web real-time communications. WebRTC is a very exciting, powerful, and highly disruptive cutting-edge technology and an open-source streaming protocol.

WebRTC is HTML5 compatible and you can use it to add real-time media communications directly between browsers and devices. And you can do that without the need for any prerequisite of plugins to be installed in the browser. Previously, external plugins were required in order to achieve similar functionality as is offered by WebRTC. And Webrtc is progressively becoming supported by all major modern browser vendors including Safari, Google Chrome, Firefox, Opera, and others. Thanks to WebRTC, we can experience sub-second/real-time latency in video streaming. Let’s find out what is WebRTC streaming server.

Web RTC

What is WebRTC Server?

A server that provides the functionality required for the proper connection of WebRTC sessions in the cloud or self-hosting in order to make your WebRTC projects work is called a “WebRTC server”.

Types of WebRTC Server?

There are 4 types of WebRTC servers:

  1. WebRTC application servers
  2. WebRTC signaling servers
  3. NAT traversal servers for WebRTC
  4. WebRTC media servers

WebRTC application servers

Webrtc application servers are basically, application and website hosting servers. Yes, that’s all.

WebRTC signaling servers

WebRTC signaling server is a server that manages the connections between devices. It is not concerned with the media traffic itself, its focus is on signaling. This includes enabling one user to find another in the network, negotiating the connection itself, resetting the connection if needed, and closing it down.

NAT traversal servers for WebRTC

Network address translation traversal is a computer networking technique of establishing and maintaining Internet protocol connections across gateways that implement network address translation (NAT).

NAT traversal techniques are required for many network applications, such as peer-to-peer file sharing and Voice over IP.

WebRTC media servers

A WebRTC media server is a type of “multimedia middleware” (located in the middle of the communicating peers) through which media traffic passes as it passes from source to destination. Media servers can offer different types, including processing media streams and group communications (distributing media streams created by a peer between several receivers i.e. Multi-Conference Unit, acting as an MCU), mixing (converting several incoming streams to a single composite stream), transcoding (adapting codecs and formats between incompatible clients), recording (permanent storage of media exchanged between peers), etc.

Many popular WebRTC services are hosted today on AWS, Google Cloud, Microsoft Azure, and Digital Ocean servers. You can embed your WebRTC media into any WordPress, PHP, or another website.

Now, we know enough about the WebRTC server. It is time to dive into WebRTC Multiparty Topologies.

WebRTC Multiparty Topologies

Mesh Topology

Mesh is the simplest topology for a multiparty application. In this topology, every participant sends and receives media from all other participants. We said it is the simplest because it is the most straightforward method. Moreover, there are no tricky works and a central unit such as a WebRTC server.

Web RTC

Mesh Topology in WebRTC

Pros:

  • It requires only basic WebRTC implementation.
  • Since each participant connects to the other peer-to-peer, no need for a central server.

Cons:

  • Only a restricted number of participants (nearly 4–6) can connect with each other.
  • Since each participant sends media to each other it requires N-1 uplinks and N-1 downlinks.

Mixing Topology and MCU

Mixing is another topology where each participant sends its media to a central server and receives media from the central server. This media may contain some or all other participant’s media. This central server is called MCU.

Web RTC

Mixing Topology and MCU in WebRTC

Pros:

  • Client-side requires only basic WebRTC implementation.
  • Each participant has only one uplink and one downlink.

Cons:

  • Since the MCU server makes decoding and encoding each participant’s media, it requires high processing power.

Routing Topology and SFU

Routing is a multiparty topology where each participant sends its media to a central server and receives all other’s media from the central server. This central server is called SFU.

Web RTC

Routing Topology and SFU in WebRTC

Pros:

  • SFU requires less processing power than MCU.
  • Each participant has one uplink and four downlinks.

Cons:

  • SFU requires more complex design and implementation on the server-side.

You can check here to get more information.

Transcoding

Transcoding is the process of decoding compressed media, changing something on it, and then re-encoding it. Change is the keyword of this process. What can be changed in the media?

First, you can change the codec since some codecs are compatible with protocols or players.

Moreover, transrating is one change that is on the bit rate of media. For example, changing the media bitrate from 600kbps to 300kbps.

Another change is trans-sizing which is in the size of media. For example, changing frame size of a media from 1280×720 (720p) to 640×480 (480p) is trans-sizing.

Besides, there are lots of other changes or filtering processes available in the video processing area.

Adaptive Bitrate

Adaptive bitrate streaming is the adjustments to video quality according to the network quality. In other words, if the network quality is low then the video bitrate is decreased by the server. This is necessary to provide uninterrupted streaming under low-quality network connections. Clearly, the different bitrates of the stream must be available to provide an adaptive bitrate technique. One way to have different bitrates of the stream is transrating. Namely, the server produces different streams with different bitrates from the original stream. However, transrating is expensive in terms of processing power.

Simulcast

One alternative to transrating to provide adaptive bitrate is simulcast. In this technique, the publisher sends multiple streams with different bitrates instead of one stream. The server selects the best stream for the clients by considering the network quality.

With the change and development of communication needs in the world, the curiosity and interest in WebRTC and therefore WebRTC servers are increasing.

What made me write share?

i’ve been working on a WebRTC stack for a while. Had crazy ups and downs. For those who dont know me, i’m Dipesh Bhoir: The guy whose building some epic stacks.

  • If your need countless maps try mapwale.com
  • looking for cool palettes, gradients, patterns, shades, try koirang.com
  • want standard icons to use in project must try iconwho.com

Thanks for reading, have a good life.

--

--