WebRTC series WebRTC understand the basic concepts

Here Insert Picture Description
Here Insert Picture Description

WebRTC (Web Real-Time Communications)
is a real-time communication technology, which allows network applications or sites, without the aid of an intermediary, to establish a connection point (Peer-to-Peer) between the browser for video streaming and (or) an audio stream, or any other data transmission. These standards include WebRTC enables users without having to install any plug-ins or third-party software to create ad-hoc (Peer-to-Peer) data sharing and conference calls possible.

WebRTC standard document by W3C

MDN Web docs for WebRTC


A typical WebRTC application process:

Here Insert Picture Description

mediaDevices.getUserMedia

MediaDevices interface provides access to the media input device is connected, such as a camera and a microphone, and a screen sharing

RTCPeerConnection

RTCPeerConnection interface represents a distal end connected to WebRTC by the local computer. The interface provides for creating, maintaining, monitoring, implementation of closed connections.

Signaling Server

Signaling server role is to help us will not be the same user on a computer connected.

General use web socket server to achieve better signaling.
Here Insert Picture Description

ICE Interactive Connectivity Establishment

ICE is an acronym for Interactive Connectivity Establishment of Interactive Connectivity Establishment of English.

Interactive Connectivity Establishment (Interactive Connectivity Establishment --ICE) developed by MMUSIC working group of the IETF, it provides a framework to enable the various NAT traversal technology can achieve unity. The technology enables SIP-based VoIP clients to successfully penetrate all kinds of firewalls between the network and remote users may exist.

STUN

STUN (Simple Traversal of User Datagram Protocol through Network Address Translators (NATs), NAT Simple Traversal of UDP) is a network protocol that allows clients located NAT (or multiple NAT) to find out after his public addresses, check out after their own what type of NAT NAT port located on the Internet side and one for the local port is bound. This information is used to establish communication between hosts UDP after the two are simultaneously in NAT router. The protocol is defined by RFC 3489. Currently RFC 3489 agreement has been replaced by RFC 5389 agreement, the new agreement, the STUN NAT traversal is defined as a tool to assist, not independent of providing solutions across. It is an updated version of RFC 7350, it is currently being perfected.

NAT

Network Address Translation (NAT) is used to provide a public IP address for your device. The router has a public IP address, each device connected to the router will have a private IP address. Private IP conversion request from the device to have a unique public IP router ports. So you do not need to set up each device a unique, public IP, but you can still find it on the Internet.

Some routers will limit who can connect to devices on the network. This may mean that, even if we have a public IP address of the STUN server is found, and no one able to create a connection. In this case, we need to take turns.

TURN

TURN protocol allows objects behind a firewall or NAT can receive data via TCP or UDP. This use of a symmetric NAT (or firewall) network having a particular practical value [1].
Thinking TURN way to solve the problem with NAT STUN similar to access a private network by a user in advance to obtain a mechanism which corresponds to an address in the private address based on the public network (STUN embodiment obtained address with the address on the NAT outlet, TURN way to get address for the address on TURNServer), then the address information in the packet load as described directly fill the public network address of the way, the practical application of the principle is the same.
TURN full name Traversal Using Relay NAT, namely through Relay NAT traversal way, TURN application model by assigning TURNServer address and port as a client to accept the external address and port that the message should be sent through the private network user TURNServer be Relay forward, this approach has the advantage of application of the model in addition to the STUN way, but also to address the shortcomings of STUN application can not penetrate symmetric NAT (SymmetricNAT) and similar Firewall equipment, namely, whether intranet / CPN export what type of NAT / FW, can be achieved through NAT, and TURN support TCP-based applications, such as H323 protocol. Further TURNServer control allocation address and port can be assigned RTP / RTCP address (RTCP port number of the RTP port number plus 1) as the local customer acceptance addresses, avoiding the outlet NAT under STUN application model of RTP / RTCP address port number any distribution, so that the client can not receive the peer over the RTCP packet (when the end of the RTCP packets sent, destination port number default by RTP port number plus 1 is sent)
that all packets must go through the limitations TURN TURNServer forward, increasing the likelihood of latency and packet loss of packets.

SDP

Session Description Protocol (SDP) is a standard describing multimedia content (e.g., resolution, format, codec, encryption, etc.) connected, so that the two peers can be understood in each data transmission. In essence, this is the metadata that describes the content, rather than the media content itself.

Thus, technically, the SDP is not a real protocol, but a shared medium connecting device between the data format used for description.

SDP record far beyond the scope of this document; however, here are some things worth noting.

Structure
SDP one or more lines of text consisting of UTF-8, each row, depending on the type of format begins with a character type, followed by an equal sign ( "="), followed by a value or a structured text description thereof. Given beginning with the letter of the text line it is often called "letters row." For example, the media description line provided with "m" type, these lines are called "m-line".
Here Insert Picture Description


Recommended reading:

Chat and Push message WebSocket implemented

ICE server build (update this week)

Implements a one video calls and text chat demo (java implementation Signaling Server)

Here Insert Picture Description

Here Insert Picture Description

Published 58 original articles · won praise 11 · views 20000 +

Guess you like

Origin blog.csdn.net/wangxudongx/article/details/105414629