Introduction to WebRTC

Spread the love

WebRTC is a framework that enables real time peer to peer communication between web browsers via a javascript API. With WebRTC , you can share live video and audio between peers. You can also use it for low latency file and data transfer.

Browser Support

Most recent web browsers support WebRTC without any plugins, you can find out which browsers support WebRTC here . Since many browsers have implemented WebRTC differently, support for certain WebRTC API’s varies depending on the browser, WebRTC also changes frequently, with many browsers requiring using the API with prefixes. The adapter.js shim is used to insulate us from most of these changes.

Peer to Peer

WebRTC allows two ‘peers’ to communicate and send data to each other directly without sending the data to a server in-between, You do need a signaling server, which is used to setup the connection so that the two peers can find each other. If you need to connect more than 2 participants to a call or data transfer session, you can then employ the use of a media server.


WebRTC versus Web Sockets

There are a few commonalities between WebRTC and WebSockets , they both requires servers, even though WebRTC is peer to peer, the initial connection has to be setup using a signaling server. Both can stream video/audio/data.

One of the main differences between the two is that once the connection is established, WebRTC streams data peer to peer, whereas in WebSockets all data must flow through the websocket server.

WebSockets are also supported by many more browsers, even some legacy browsers can support WebSockets via ployfills available.

WebRTC is also very secure as the data streamed from one peer to another is end to end encrypted.

WebSockets uses TCP, so all data is received in the same order, which also means that packet loss/drops can delay all subsequent packets. WebRTC uses UDP and can be configured to be used in reliable or unreliable mode.