WebRTC multi-user connection

I have successfully connected clients A and B. The problem is that I want to add new clients, C and D, to create a group chat. Do I need to create a new RTC connection and offer suggestions / answers / ICE for each client? For instance:

A connects to B A connects to C A connects to D B connects to C B connects to D C connects to D

Each of the above client combinations creates its own RTCPeerConnection and goes through the webrtc handshake (offer, icecandidate, answer)

+5
source share
1 answer

Do I need to create a new RTC connection and offer suggestions / answers / ICE for each client?

That's right. Each client simply needs to create a new RTCPeerConnection , attach their own unique audio and video tracks to them, and exchange their SDP and ICE candidates each time a new client arrives.

An example is available here: https://webrtc.imtqy.com/samples/src/content/peerconnection/multiple/

Source code: https://github.com/webrtc/samples/blob/gh-pages/src/content/peerconnection/multiple/js/main.js

+2
source

Source: https://habr.com/ru/post/1258272/


All Articles