- Topics
- /
- Event-driven servers
- /
- WebRTC
WebRTC
WebRTC (Web Real-Time Communication) is a group of APIs and protocols which allow web and mobile applications to implement real-time communication, including, but not limited to, audio and video streaming and capture. Instead of having to rely on a client-server model of data transfer, WebRTC has peer-to-peer capabilities out of the box, meaning data can be streamed directly between browsers. This also means you don't need any plugins or 3rd party apps to implement it into your apps.
WebRTC interconnectedness among devices
History of WebRTC
Global IP Solutions (GIPS) was a telecommunications company that specialized in VOIP and video conferencing. It developed some realtime communication (“RTC”) components, including internet speech audio codecs and low bitrate codecs. Google bought GIPS in 2010 and inherited this work, which then became WebRTC. Initially a set of realtime communication APIs, it was made open-source and then released as WebRTC in 2011 with collaborative work between W3C, the IETF and Google. The first draft spec was published that same year. The latest WebRTC spec, along with its previous iterations, is available on the W3C website.
WebRTC history
What are WebRTC Data Channels?
The act of sending data between peers is done by opening a WebRTC data channel using the RTCDataChannel interface. This supports the bi-directional exchange of data over an open connection, similar to other data transfer APIs such as the WebSocket API. The RTCDataChannel interface simplifies the process of sending data between peers, which can be very convoluted and involved. You can follow this Ably WebRTC tutorial to learn how to implement it within your application.
Secure by default All data that's transported via RTCDataChannel is encrypted by default using the Datagram Transport Layer Security (DTLS), which uses TLS as its foundation, meaning any data sent with RTCDataChannel is as secure as any data sent using HTTPS. Another security benefit is that since WebRTC API transports data between peers, the data never passes through the application or the internet, reducing the chances of it being intercepted or manipulated during transit.
Outbound buffering support Outbound data buffering is automatically handled and you can view information and receive notifications about the buffer.
Cross-platform support All WebRTC interfaces are available to use across multiple platforms, ensuring a wider pool of people has access to the APIs regardless of their browser.
TCP and UDP support TCP allows the transmission of data without packet loss and if the amount of data is too large, it can fall back to use UDP.
64KiB limit Since the protocol RTCDataChannel relies on (Stream Control Transmission Protocol – SCTP) was originally made to send signals which tend to be small in size, the interface doesn't have the capability to send large messages. This limit is reduced to 16KiB if you're doing cross-browser data transport.
Limitations with outbound buffering support At this time, it's not possible to set the size of the buffer.
UDP use can lead to data loss Using UDP gives permission for data loss to occur, which can lead to damaged and corrupted data.
Additional Reading
Recommended Articles
SockJS
Learn about SockJS, a browser JavaScript library that provides a WebSocket-like object.
Apache Kafka vs RabbitMQ vs AWS SNS/SQS: Which message broker is best?
Discover the key considerations for choosing a message broker and how to choose between Apache Kafka, RabbitMQ, and AWS SNS/SQS.
Socket.IO vs SockJS
Compare realtime libraries Socket.IO and SockJS on performance, scalability, developer experience, and features.