WebRTC the magic behind Communications over the Internet— part 1: What is WebRTC, various architectures
During the pandemic, when office workers were home and students couldn’t attend school, the world kept turning. Jobs continued, and education persisted, all thanks to video conferencing. Whether it was office meetings, virtual classes, or connecting with loved ones, video conferencing became our lifeline. Even in the post-pandemic world, its power boosted the remote work culture. Behind all these tools and apps, WebRTC was the unsung hero making it all possible.
What is WebRTC?
WebRTC is a free, open-source technology that allows real-time audio, video, and data communication in web browsers and mobile apps. It uses the MediaStream API to access your microphone and webcam, which is an extension of the HTML5 video and audio elements. With WebRTC, you can create applications like video chats, file sharing, and screen sharing without needing plugins or extra software. It’s supported by all major browsers, including Chrome, Firefox, Opera, and Safari. WebRTC is also used in some email clients, messaging apps, and VoIP services.
Well, i get it this simple definition rather than giving clarity raises even more questions — what is media stream, how does the communication take place, what’s inside this black-box “open-source technology”, and wait the major browsers have built-in support?? — I bet there are several questions here.
I’ll be trying to answer all the above questions through all the articles in this series, for now, let’s look at various WebRTC Architecture.
Various WebRTC Architecture
In WebRTC the topologies can be classified into three different types depending on the components used in the system and the way they interact. These are —
- Peer-To-Peer (P2P)
- Selective Forwarding (SFU)
- Multi-Point Control (MCU)
Peer-To-Peer Architecture
It is the most simple architecture where each client interacts with the other client with a direct connection between them. This has the least complexity to create and manage. As there are no central servers all the traffic goes through clients. This architecture is simple and efficient but it has limitations to its scalability. It does not work well with a large number of clients because with each increasing client the connections increase exponentially and such large throughputs of data will consume the network rapidly resulting in very poor performance.
Selective Forwarding Architecture
It is a more complex architecture that uses a central server to manage all the media streams. In this, the Clients are not directly connected rather they are connected to a central server. Clients send their media streams to the central server which then forwards them to the others in the group. In this, the server decides which media streams are sent to which clients. This reduces the traffic faced by the clients thus making it possible to support a large number of clients. This architecture is scalable but there is some latency involved since the media streams will have to travel through the server which decides where to send the streams before reaching the destination.
Multi-Point Control Architecture
It is the most complex architecture here multiple servers are used to manage the media streams. After clients send their media streams to a server it forwards them to other servers in the system. Here we can optimize the latency by planning a good strategy to distribute the traffic — we dedicate some servers to only receive the media streams from the clients and others to only send them to the clients. This approach reduces the latency by distributing the traffic across servers, but this also adds up to the costs for setting up this complex system thus it is used only in case of large-scale systems where low latency is essential.
With this overview, you now have a solid grasp of the different WebRTC architectures and an idea of where each one shines. Get ready for the next article, where we’ll pull back the curtain and explore the magic happening behind the scenes. Stay tuned — it’s going to be a thrilling ride!