Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webRTC multi-peer connection

Tags:

webrtc

I have successfully connected clients A and B. Problem is I want to add new clients, C and D to build a group chat. Do I need to spawn new RTC connection and exchange offer/answer/ICE candidates for each clients? For example:

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 combination spawns their own RTCPeerConnection and goes through the webrtc handshake (offer,icecandidate,answer)

like image 891
r2b2 Avatar asked Oct 16 '16 00:10

r2b2


People also ask

How many connections can WebRTC handle?

As many as you like. You can cram anywhere from one to a million users into a WebRTC call.

Is WebRTC peer-to-peer?

WebRTC is a peer-peer communication protocol.

What is WebRTC peer connection?

Peer connections is the part of the WebRTC specifications that deals with connecting two applications on different computers to communicate using a peer-to-peer protocol. The communication between peers can be video, audio or arbitrary binary data (for clients supporting the RTCDataChannel API).


1 Answers

Do I need to spawn new RTC connection and exchange offer/answer/ICE candidates for each clients?

Exactly. Each client just need to create new RTCPeerConnection, attach their unique audio and video tracks to them and exchange their SDP & ICE candidates every time a new client arrives.

An example is available here: https://webrtc.github.io/samples/src/content/peerconnection/multiple/

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

like image 112
Axel Isouard Avatar answered Sep 28 '22 06:09

Axel Isouard