- WebRTC Tutorial
- WebRTC - Home
- WebRTC - Overview
- WebRTC - Architecture
- WebRTC - Environment
- WebRTC - MediaStream APIs
- WebRTC - RTCPeerConnection APIs
- WebRTC - RTCDataChannel APIs
- WebRTC - Sending Messages
- WebRTC - Signaling
- WebRTC - Browser Support
- WebRTC - Mobile Support
- WebRTC - Video Demo
- WebRTC - Voice Demo
- WebRTC - Text Demo
- WebRTC - Security
WebRTC - Protocols
Real-time data communication means a fast connection speed between both user's devices. A common connection takes a frame of video or audio and transfers it to another user's device between 30 and 60 times per second in order to achieve a good quality. So it is important to understand that sending the latest frame of data is more crucial than making sure that every single frame gets to the other side. That is why WebRTC applications may miss certain frames in order to keep a good speed of the connection.
You may see this effect almost in any video-playing application nowadays. Video games and video streaming apps can afford to lose a few frames of video because our mind try to fill these spaces as we always visualize what we are watching. If we want our application to play 50 frames in one second and we miss frames 15, 25, and 38, most of the time, the user won't event notice it. So for video streaming applications there is a different set of requirements −
This is why WebRTC applications use UDP (User Datagram Protocol) as the transport protocol. Most web applications today are built with the using of the TCP (Transmission Control Protocol) because it guarantees that −
any data sent will be marked as received
any data that does not get to the other side will be resent and sending of other data will be temporarily terminated
any data will be unique without duplicates on the other side
You may see why TCP is a great choice for most web applications today. If you are requesting an HTML page, it makes sense to get all the data in the right order. But this technology can not fit for all use cases. If we take, for example, a multiplayer game, the user will be able to only see what has happened in the last few seconds and nothing more which may lead to a large bottleneck when the data is missing −
The audio and video WebRTC connection is not mean to be the most reliable, but rather to be the fastest between two user's devices. So we can afford losing frames, which means that UDP is the best choice for audio and video streaming applications.
UDP was built to be a less reliable transport layer. You can not be sure in −
- the order of your data
- the delivery status of your data
- the state of every single data packet
Nowadays, WebRTC sends media packets in the fastest way possible. WebRTC can be a complex topic when concerning large corporate networks. Their firewalls can block UDP traffic across them. A lot of work have been done to make UDP work properly for wide audience.
Most Internet traffic today is built on TCP and UDP, not only web pages. You can find them in tablets, mobile devices, Smart TVs, and more. So it is important to understand how these technologies work.
Kickstart Your Career
Get certified by completing the courseGet Started