I am about to build a videoconferencing system using webRTC+socket.io+node.js, so I have read this book as start point "Real Time communications with webRTC" by Simon Pietro Romano, I already finished reading it, I am gonna run this system over a 100 Mbps local network, so I am gonna use the mesh network topology since bandwidth is no an issue here, I don't wanna focus on this, I just have a simple question on working with many users, specifically on using these functions:
var pc // PeerConnection Object
pc.onaddstream = ...//for receiving stream from remote party
pc.setRemoteDescription()...//for setting .sdp file from remote party
I know I have to make a peer-to-peer connection on each peer, but Let's suppose that I have 3 users: A, B and C.
A is gonna be the room initiator, then B joins the room, here A sends an offer to B and receives an answer from B, A setRemoteDescription(answerB) and B setRemoteDescription(offerA), but when C joins the room, A and B will be its initiators, so both of them will be send offers to C, and C will send answers to them, here is my confusion:
When C first receives offer from A, this is C setRemoteDescription(offerA), but when receiving offer from B, this is C setRemoteDescription(offerB), I am setting a new value here and losing the previous offer from A, is this procedure just temporary?, isn't C going to need the A offer anymore?, I know this sdp file just contains webbrowser media info. I have the same doubt with onaddstream, Does this procedure automatically catch stream from one peer and then from another peer?, A first catch B's stream and second from C when this last one joined the room?, Does A lose B's stream when catching C's?.
On the other hand, addIceCandidate just adds remote candidates to each peer, so a local peer have the remote peers routes, it never loses the remote peers routes, I think, Am I right?
I have found source code about webRTC videoconferencing and I have seen that onaddstream and setRemoteDescription are like temporary functions, once the connection between peers is set, those are not neccesary anymore, I don't know, maybe I am wrong.
Thanks in advance.
PeerConnection
object, you are going to need one for each call... – mido