5
votes

I am using a web socket server (node JS) to act as a signaling server. I want to create a P2P mesh network - everyone is connected to each other.

What would be the order of operations/events when:

  1. The 1st peer joins
  2. The subsequent peers join

Do every connecting peer send an offer to the signaling server that is then sent to all other connected peers? I am unsure whether this is the right approach.

2
As far as I know, WebRTC does not describe signalling mechanism (it's strong pointed in their tutorial). It's up to developer, how he will make it. Communication 'all to all' in mesh is described in algorithms undependent of technology, but I suppose, that when and how you are sending informations it's just your idea. Your idea is not complicated and seems good.Krystian
Possible duplicate of WebRTC with 3 users connectionjib

2 Answers

1
votes

If what you are trying to do is create a mesh network with audio and video flowing at all times to everyone via a mesh network then I'd suggest reconsidering. Getting this to more than 3 or 4 users to work well is hard to impossible to achieve. See here for an explanation of what goes on the network for different network topologies: http://testrtc.com/different-multiparty-video-conferencing/

If you are trying to do this to get data connected (non voice or video), then you can do that, but again, the number of peer connections you can place in a single browser is limited and each one you add puts some overhead. Today, I wouldn't try to get this over 40 or 50 at most.

By your question, I am assuming all clients will be connected to your server via a WebSocket. You will probably end up routing messages through the server and creating peer connections judiciously when you want to connect a specific user to another one - or a small group of users together.

For the group scenario, I'd use an SFU model - look at Jitsi (https://jitsi.org/Projects/JitsiVideobridge) and Kurento (http://www.kurento.org/) for possible alternatives.

0
votes

WebRTC connects client to client. If your client connects to at least one other - the other can have a list of others, as the others also has a list of as many others they possible can know. Then it propagates fast. The topology in the list is up to you. Signaling is not needed, because the information to connect with others is in the list.