Example of full mesh webrtc network?

Hi,

I’m developing a small video conferencing app with phoenix and webrtc. So far I’ve figured out how to connect one to one and how to do signalling via channels. What I’m struggling with is creating and using multiple peer connections. And I can’t seem to find any tutorials on how to do this that aren’t either several peers on one page or using a third party api. I would really appreciate an example of how this is done properly, it doesn’t have to be with phoenix.

TL:DR: I’m looking for a code example/tutorial on creating a full mesh peer connection without third party api.

1 Like

:wave:

And I can’t seem to find any tutorials on how to do this that aren’t either several peers on one page

Do you want your peers to be on different pages?

As for tutorials, I’m not sure they are necessary since there isn’t much to webrtc api, you can read through it on https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API in a few hours probably, the explanations are quite clear there.

Here’s https://github.com/webrtc/samples/tree/gh-pages/src/content/peerconnection/multiple a sample project with multiple peer connections.

The issue I’m having is with creating multiple peers on a page that are supposed to connect to multiple peers on another page.

And I can’t seem to find any tutorials on how to do this that aren’t either several peers on one page

I was referring to https://github.com/webrtc/samples/tree/gh-pages/src/content/peerconnection/multiple , it’s basically several peers on a single page talking to themselves which isn’t super useful, for me at least.

As for tutorials, I’m not sure they are necessary since there isn’t much to webrtc api, you can read through it on https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API in a few hours probably, the explanations are quite clear there.

That guide explains the basics of webrtc not how to create and manage multiple peer connections at once.

The page the peers are on doesn’t really matter. Just share the js code for connection setup on both of these pages and it should work.

I didn’t mean the guides on mdn, rather the api reference. It would help you understand what’s needed to make what you want work.

I didn’t mean guides on mdn, rather the api reference. It would help you understand what’s needed to make what you want work.

I more or less have a concept of how webrtc api works, I’m just really bad at javascript. Rather the problem I’m having isn’t that I don’t know how to set up a connection between two peers but that I don’t know how to write a client side function that will send and receive all of the offers/answers properly.

For example: I have 3 peers on my page, I need each of them to send and receive the appropriate offers to the appropriate peer on the other four pages. And then to appropriately receive the answers and form a connection.

I understand that with sufficient knowledge of webrtc api and some effort I can hack together some system for doing this. I was just looking for an example of how this should be done properly before trying to “reinvent the wheel”.