1

Help me understand how the signaling works in WebRTC. Specifically, if I have a given channel, say using Amazon Kinesis or a similar product, how would a peer know which peer to call? Do I need a dedicated channel per set of all peers that need to connect?

Say we have 5 peers and we like to have the following connection topo: i.e.

Peer1<->Peer2
Peer2<->Peer3
Peer4<->Peer5

When peer1 creates offer and sends them to signal channel1, how would Peer2 know this offer is only intended for them? How would Peer4 know not to consume that offer?

Do we need one channel per set of peers that need to connect? In this case, probably two channels? one that handles 2<->1 2<->3 and one for 4<->5?

Mohammad
  • 714
  • 4
  • 13

1 Answers1

3

KVS is designed right now to connect peers 1:N, so you have one master and it connects too many viewers. By design Peer2 and Peer3 can not see each other.

         | -> Peer2
         | 
Peer1 -->|
         |
         | -> Peer3

I am not sure, but it sounds like you are looking for a mesh topology, where every peer can see each other? This is what you usually want for conference rooms, or an n:n setup.

Peer1 -> Peer2
Peer1 -> Peer3
Peer2 -> Peer3

This is not available today, but if this is something we are exploring adding.

Sean DuBois
  • 3,972
  • 1
  • 11
  • 22
  • Thank you Sean. I figured that much when looking at the KVS SDK. But my question is really around the need for channels. In the example I provided, do I need two channels or can it be achieved with one? – Mohammad Apr 09 '20 at 21:58
  • You should only need one channel! To simulate use https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-js/examples/index.html and have `Peer2` be the master, and then Peer1 and Peer3 can both join the same channel as viewers. – Sean DuBois Apr 09 '20 at 22:11
  • And if there were peers 4 and 5 in there that wanted to connect only to each other (4<->5) is that still within the same channel or that would be a new channel for just them? I guess the question really is not so much of KVS as it is the general methodology of how would one peer know to connect to another peer? is it because there is a message in the channel waiting for "anyone" in that channel? If so, then there is a need for multiple channels to isolate "who" gets the offer for connection. – Mohammad Apr 09 '20 at 22:21
  • 1
    Peers 4 <-> 5 would not be able to connect to each other. If they joined the channel they would both be forced to communicate with `Peer2`. These are all KVS specific things, WebRTC itself just lets two people establish a P2P connection. We just have control how those messages flow. – Sean DuBois Apr 09 '20 at 22:29
  • @SeanDuBois I am having same doubts as Mohammad. So, it is recommended to create a dedicated channel for every meeting. Is a good practice to create/delete, on the fly,channels for every meeting planned? (imagine a telehealth app where meetings happens and it's really probable that they won't happen again in the short term) – X.Otano Sep 23 '20 at 08:56