What happens when a user joins a room at maximum capacity?
Liveblocks allows you to gracefully handle maximum user limits in rooms. But first, when is a room at maximum capacity?
- A room is full when it’s hit your maximum simultaneous connections per room limit.
- Your maximum simultaneous connections limit is defined by your current plan.
- Any users above that count will not be able to join the room.
- Any users already in the room will not be affected by another user trying to join.
- If a user can’t join a room, they will not be counted towards your MAUs.
For example, let’s say your plan allows for 50 simultaneous connections. If there’s a room that currently has 50 users inside, Marie (the 51st user) will not be able to join the room. If Marie tries to join, the first 50 users in the room will be unaffected, and the room will function as normal. However, Marie’s client will receive an error, which can be handled.
Error is thrown when a user tries to join a room that’s full,
instead you can listen for error events, which are helpful for displaying a
warning or redirecting the user elsewhere.