node.jsreactjssocket.iowebrtcsimple-peer

Webrtc with multiple peers - It's establishing connection not more than four people


I'm developing a video chat application for multiple users using socket.io ans simple-peer. I'm using react for front end and node js for server. Deployed the server in heroku(Now I'm using free dynos only). I'm also using my own TURN server.

It is working without any trouble for four devices . One of the existing peer disconnects when the fifth one connects.

I couldn't find what I'm missing. I'm trying to connect 10 peers in a room.

Do I need media server for streaming? or I have to change anything in the signalling server or TURN server?

Any help would be appreciated.


Solution

  • The average user's computer cannot maintain a lot of peer connections at the same time. If you use mesh topology in your WebRTC app, the recommended number of users in the chat room is 4. If the number is higher, it begins to load the CPU much more and the p2p connection with each peer becomes unstable. If you want your application to support multiple participants in the room, you should integrate SFU into your app (mediasoup, for example).