How WebRTC & WASM are opening new opportunities for web apps

by Aaditya Mandloi

In terms of online communication and collaboration we have come far from the era of text based delayed communication to real-time platform agnostic multimedia experiences.

Thanks to Google and their open-source platform WebRTC, we can develop video-chat applications like Skype and Whatsapp using HTML and pure JavaScript within the browser.

Google has also talked about how WebAssembly fits in its recent work of audio pipeline for WebRTC in Chrome and the work ahead around WebRTC NV. In which, the Low Level APIs are about places where WebAssembly can be used.

Result. Replacing the need to write so much code, allowing to port codes, and it’s really supported across the entire web ecosystem in every browser.

WebRTC NV (New Version) shaping the future

It is an umbrella term for different technologies developers, vendors and every other service provider would seek into WebRTC New Version. This includes some major topics:

  • WASM: Second language supported by all major web browsers. First? JavaScript.
  • QUIC: A modern congestion control mechanism that affects the time you wait when loading a page.
  • AV1: A royalty-free video codec delivering the high performance video streams.

Before diving into what role WebAssembly plays in WebRTC, let’s have an introduction of WebRTC; WASM and its value outside of WebRTC.

WebRTC

While many of us are excited about WebRTC as it will enable several cool gaming applications and improve the availability and performance of video conferencing apps, WebRTC is proving to be a great tool for social apps.

The communication is extremely fast with low latency as the connection is peer to peer; no requirement to install external plug-ins or other third-party software, and no server in the middle.

And such apps are built when various interrelated APIs and protocols of WebRTC work together. WebRTC APIs are designed around JavaScript APIs with 3 main objects. These are:

  • GetUserMedia, enabling access to the cameras and microphones of the device
  • PeerConnection, taking care of all media transport activities in WebRTC
  • DataChannel, dealing with proprietary data transmission between clients

Reducing End-User Friction

WebRTC enables the web to be much more capable and interactive. Digital support services and storefronts can now include the ability to communicate and ‘dial’ right from within the website. This increases the chance of using the service more as it reduces the friction with the end-users. There are many ways in which market is exploiting this capability:

  • As a place to have a voice chat with friends (Talkroom.io offers WebRTC screen sharing)
  • For connecting live with tutors (Prep Lesson, Kwiizi), doctors (Bridge) or experts (24sessions, ClassOnLive)
  • For discussing projects in real time (Solaborate, GearCloudLabs); as a video interviewing instrument (Plumvue)
  • For business conferences (FACEmeeting, Kenja Corporation, UberConference), often as a SaaS solution (Jell);
  • As a call center or customer care platform, also as a SaaS solution (RichCall, Client Bee, Aircall, and so on)

This reduction in friction has the potential of increasing the value of the service employing WebRTC. Let’s further look into the areas of WebRTC where people are exploring the potential of their web applications.

WebAssembly: What is so compelling about it?

You take code written in other languages (like C, C++ and Rust), compile that code to WebAssembly, and run it in the browser. The compelling factor?
WASM consistently guarantees native speeds much faster than JavaScript. Somewhat near. The most compelling factor is-

Designed with the sandbox model of the web in mind, WASM is based on an open standard, meaning all browsers will have to comply with the same rules. So waiting for browser vendors to upgrade their standards at different paces could be a thing of the past.

Although we’re still in the early stages, WASM is already being used in real-world applications:

  • To port entire CLIs/games/desktop apps to the web: AutoCAD used WebAssembly to port their 30-year-old codebase to the web without having to rewrite everything from scratch.
  • Applying it surgically to speed up front-end computations: Ebay designed a compilation pipeline including C++ and Javascript to implement a WebAssembly-based barcode scanner and saw its Draft Completion Rate improved by 30%.
  • Even using it outside the browser: Serverless providers like Cloudflare and Fastly using WASM modules reported faster launch of functions than most cloud providers can with other languages.

Looking to the near future, WebAssembly will gain the ability to directly manipulate the DOM, gain the support for garbage collection, SIMD instructions, and threads, just to name a few.

What’s the role of WASM in WebRTC?

WebRTC is maturing, and with it, the vendors are trying to adopt it.

Enabling WebAssembly in WebRTC will allow developers more control of media processing and thus take it to the next level. This is going to be great for those looking to innovate and differentiate or those that want to take WebRTC towards new use cases and new markets, where the current implementation isn’t viable.

It is also going to require developers to have a better understanding of WebRTC if they want to unlock such capabilities.

Savvy developers will LOVE WebAssembly in WebRTC. It allows them to:

  • Do stuff they can’t do today- without waiting on Google and the other browser vendors
  • Add their own shtick
  • Have way more control over the browser behavior with WebRTC

Companies have been using customized WebRTC implementations to solve problems that are very close to what WebRTC does, but with a difference.

If they’d have low level API access, they could use WebAssembly and run those same use cases in the browser instead of having to port, compile and run their own stand-alone applications.

Conclusion

Coupled with availability through browsers across mobile devices and on multiple operating systems, this brings the development and testing costs down to the point where it makes sense to start using it.

WebRTC is no longer a future-tech, it is here and now. It is enabling people with the tools required to cope with the current situation. It is strengthening our efforts of working remotely, as world economy gets back on track.

Published On:March 26, 2020