Bandwidth cost would be your first worry, the day you host it with 12-24 viewers… heh;
I blow through almost 30-100+TB a day with just 27 cores.
But for handling it’s best done client-side, if user see’s lag they can restartice, this process should connect them but there should be a means to know if the media-server is offline via a broker or chat-server ping/pong to it. Your signalling will tell users if server is offline, and user will determine if lagging to request new ice.
For scaling, there’s so many different ways to go about this. But to help those understand…
0 - 1,000 users maximum user base.
You want simple and for that a broker server is to be written to allow all chat, producer, consumer servers to connect, it then routes all the data to the respective servers (Optimal NoSQL solution).
This solution is savage and is really cool for keeping zones connected but if over-loaded it lacks significantly. We cannot just keep adding servers here… (slows down and gets complicated fast)
1,000 - 50,000
You can still use the broker method but power will base on core strength and ability to queue a high level of messages per second, this is the peak though you’ll need to consider dedicated resources so the power linearly scales. Imagine 1,000 servers connected and routed with a broker + the user messages per second. This is similar to a pub/sub the IO rate is not scalable.
50,000 - 100,000++
This is enterprise level and best suggestion is to get every server to hit a read-only node of MySQL or your preferred database and determine where they should connect (making this dedicated). This method keeps connection count very low. Media-servers connect to chat-server directly and provide their service. Chat Server keeps ping/pong and can tell users failing servers!
This approach takes some smarts/moneys all sorts but if you figure it out, it’s stable performance from 1 room to millions of rooms!
There’s no perfect solution obviously if we compare discord to facebook to twitch to many services right, but that should be what encourage developers is that they can re-define this standard.
Testing/studying on a user-base of hundreds (paying every cent into it) I can confidently share this to help folks.