WebRTC call principle

WebRTC call principle STUN and TURN

What did STUN do?

Tell me what your public IP address + port is. But STUN does not always succeed in assigning IP addresses to the required NAT call devices. P2P uses local bandwidth. During a multi-person video call, the call quality needs to be determined according to the user's local bandwidth.

What STUN can't do, TURN can do.

After STUN fails to allocate the public network, you can request the public IP address as an intermediate address through the TURN server. The bandwidth of this method is borne by the server side.

Two protocols are often used in WebRTC. We use the coturn open source project to build STUN and TURN servers.

ICE (interactive connectivity establishment, interactive connection establishment)

ICE is not a protocol, but a framework, which integrates STUN and TURN. The conturn open source project integrates STUN and TURN functions.

Basic design of WebRTC call signaling

Join: join the room

Resp-join: Return the uid of another person after join joins the room, if not, it will not return.

Leave: Leave the room, the server will check if there are other people in the room after receiving leave, and notify someone to leave if there are other people.

new-peer: The server notifies the client that someone has joined, and initiates a connection request when receiving the new-peer.

Peer-leave: The server notifies the client that someone has left.

Offer: Forward the offer sdp.

Answer: Forward answer sdp.

Candidate: Forward the candidate sdp.

Guess you like

Origin blog.csdn.net/Doubao93/article/details/123469829