simple-peer icon indicating copy to clipboard operation
simple-peer copied to clipboard

Max connection in single room

Open smart0120 opened this issue 4 years ago • 14 comments

A few months ago, I have done a multiple room video chat project using peerjs. but, more than 5 users can't connect in one room. With more than 5 users, the browser stops and sometimes disconnected the server. so, I decided to convert this project using simple-peer. Now, I'm concerned about the max connection.

What is a max connection in simple-peer?

smart0120 avatar May 25 '21 09:05 smart0120

You are unlikely to see a different outcome by switching to simple-peer since the limitation you are facing is likely the hardware or network of the peers participating rather than the supporting library. As noted in the documentation , mesh networks don't scale well. That statement is not specific to simple-peer, but to WebRTC as a whole. There are solutions for this problem, but those are outside the scope of simple-peer. One such solution is to utilize an SFU (selective forwarding unit).

jarretttaylor avatar May 25 '21 12:05 jarretttaylor

@smart0120 This blog post may be of some help in understanding your options.

jarretttaylor avatar May 25 '21 14:05 jarretttaylor

@jarretttaylor Thanks for your help. I'll check this and let you know

smart0120 avatar May 25 '21 15:05 smart0120

Hello @jarretttaylor Thanks again for your help. I checked this doc and others related SFC. and I found 5 top opensource for SFC in this blog What do you recommend? and Could you please help me to set up SFU server? Looking forward to discussing more.

smart0120 avatar May 27 '21 15:05 smart0120

@smart0120 Unfortunately, I will not be of much help on this. I have neither set up nor utilized an SFU as my WebRTC projects have not needed to support more than a couple of users in a "room" at a time.

jarretttaylor avatar May 27 '21 15:05 jarretttaylor

Thanks anyway I'd like to discuss other problems in webrtc

smart0120 avatar May 27 '21 15:05 smart0120

I have a prototype app which uses simple-peer and mimics an SFU / MCU using a web browser, where all of the participants connect to that browser over P2P, not requiring a mesh connection to the other peers.

Apple M1 processors running Google Chrome seem to be the best as the network host, but I've had good experience with running old Android devices as the host and running high resolution video streams to multiple peers.

I don't think the M1 would handle 50 concurrent video connections, but it might handle 50 audio-only connections. I'm working on breaking the app apart to make the network hosting available as a library.

https://speaker.app/setup/network/create https://github.com/zenOSmosis/speaker.app

jzombie avatar May 27 '21 17:05 jzombie

Thanks for your kindly help

In my project, I also used express, mongo, socket.io, and peerjs (I'm going to use simple-peer) but, for now, I can't figure out how can you set up SFU / MCU and how can I replicate it for my project

could you please help me more?

smart0120 avatar May 27 '21 17:05 smart0120

You may want to check out https://mediasoup.org, or any of these other open-source projects: https://ourcodeworld.com/articles/read/1212/top-5-best-open-source-webrtc-media-server-projects

I have no experience setting up simple-peer with a traditional SFU / MCU and don't think it's really designed for that purpose.

Keep in mind, depending on how much you need to scale your users, you will need to scale your backend accordingly to handle all of the connections.

If it's a business requirement instead of a personal one, you might want to use something like twilio-video instead: https://www.npmjs.com/package/twilio-video

jzombie avatar May 27 '21 18:05 jzombie

Could you please check the attached file first?

smart0120 avatar May 27 '21 18:05 smart0120

I've scanned it out of curiosity, and am not on Skype.

jzombie avatar May 27 '21 18:05 jzombie

Hello @jzombie

I had a problem - Connection issue on Chrome on Mac

User A uses Google Chrome on Windows User B uses Google Chrome on Mac

When A walks up to B - video/audio doesn't connect. When B walks up to A - video/audio connects.

so, my questions are:

  • how can fix it?
  • Is this error only related peerjs? so will it be fixed. If I use simple-peer instead of peerjs?

smart0120 avatar Jun 03 '21 00:06 smart0120

I'd assume the issue is just related to peerjs. Probably just want to try to use simple-peer instead of peerjs and see if that fixes the problem. Sorry, I don't really have any other information to offer you other than that.

jzombie avatar Jun 03 '21 16:06 jzombie

thanks for your response

smart0120 avatar Jun 04 '21 13:06 smart0120