Added limit for maximum number of users in a single room
parent
4acedad987
commit
ac6ee1bfa3
|
|
@ -1963,6 +1963,13 @@ export default class RoomClient
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'overRoomLimit':
|
||||||
|
{
|
||||||
|
store.dispatch(roomActions.setOverRoomLimit(true));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 'roomReady':
|
case 'roomReady':
|
||||||
{
|
{
|
||||||
const { turnServers } = notification.data;
|
const { turnServers } = notification.data;
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,12 @@ export const setSignInRequired = (signInRequired) =>
|
||||||
payload : { signInRequired }
|
payload : { signInRequired }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const setOverRoomLimit = (overRoomLimit) =>
|
||||||
|
({
|
||||||
|
type : 'SET_OVER_ROOM_LIMIT',
|
||||||
|
payload : { overRoomLimit }
|
||||||
|
});
|
||||||
|
|
||||||
export const setAccessCode = (accessCode) =>
|
export const setAccessCode = (accessCode) =>
|
||||||
({
|
({
|
||||||
type : 'SET_ACCESS_CODE',
|
type : 'SET_ACCESS_CODE',
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,10 @@ const styles = (theme) =>
|
||||||
green :
|
green :
|
||||||
{
|
{
|
||||||
color : 'rgba(0, 153, 0, 1)'
|
color : 'rgba(0, 153, 0, 1)'
|
||||||
|
},
|
||||||
|
red :
|
||||||
|
{
|
||||||
|
color : 'rgba(153, 0, 0, 1)'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -281,6 +285,16 @@ const JoinDialog = ({
|
||||||
}}
|
}}
|
||||||
fullWidth
|
fullWidth
|
||||||
/>
|
/>
|
||||||
|
{!room.inLobby && room.overRoomLimit &&
|
||||||
|
<DialogContentText className={classes.red} variant='h6' gutterBottom>
|
||||||
|
<FormattedMessage
|
||||||
|
id='room.overRoomLimit'
|
||||||
|
defaultMessage={
|
||||||
|
`The room is full. Retry after some time.`
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</DialogContentText>
|
||||||
|
}
|
||||||
|
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
|
||||||
|
|
@ -419,6 +433,7 @@ export default withRoomContext(connect(
|
||||||
return (
|
return (
|
||||||
prev.room.inLobby === next.room.inLobby &&
|
prev.room.inLobby === next.room.inLobby &&
|
||||||
prev.room.signInRequired === next.room.signInRequired &&
|
prev.room.signInRequired === next.room.signInRequired &&
|
||||||
|
prev.room.overRoomLimit === next.room.overRoomLimit &&
|
||||||
prev.settings.displayName === next.settings.displayName &&
|
prev.settings.displayName === next.settings.displayName &&
|
||||||
prev.me.displayNameInProgress === next.me.displayNameInProgress &&
|
prev.me.displayNameInProgress === next.me.displayNameInProgress &&
|
||||||
prev.me.loginEnabled === next.me.loginEnabled &&
|
prev.me.loginEnabled === next.me.loginEnabled &&
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ const initialState =
|
||||||
locked : false,
|
locked : false,
|
||||||
inLobby : false,
|
inLobby : false,
|
||||||
signInRequired : false,
|
signInRequired : false,
|
||||||
|
overRoomLimit : false,
|
||||||
// access code to the room if locked and joinByAccessCode == true
|
// access code to the room if locked and joinByAccessCode == true
|
||||||
accessCode : '',
|
accessCode : '',
|
||||||
// if true: accessCode is a possibility to open the room
|
// if true: accessCode is a possibility to open the room
|
||||||
|
|
@ -88,7 +89,12 @@ const room = (state = initialState, action) =>
|
||||||
|
|
||||||
return { ...state, signInRequired };
|
return { ...state, signInRequired };
|
||||||
}
|
}
|
||||||
|
case 'SET_OVER_ROOM_LIMIT':
|
||||||
|
{
|
||||||
|
const { overRoomLimit } = action.payload;
|
||||||
|
|
||||||
|
return { ...state, overRoomLimit };
|
||||||
|
}
|
||||||
case 'SET_ACCESS_CODE':
|
case 'SET_ACCESS_CODE':
|
||||||
{
|
{
|
||||||
const { accessCode } = action.payload;
|
const { accessCode } = action.payload;
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": null,
|
"room.raisedHand": null,
|
||||||
"room.loweredHand": null,
|
"room.loweredHand": null,
|
||||||
"room.extraVideo": null,
|
"room.extraVideo": null,
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": null,
|
"me.mutedPTT": null,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@
|
||||||
"room.raisedHand": null,
|
"room.raisedHand": null,
|
||||||
"room.loweredHand": null,
|
"room.loweredHand": null,
|
||||||
"room.extraVideo": null,
|
"room.extraVideo": null,
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": null,
|
"me.mutedPTT": null,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": null,
|
"room.raisedHand": null,
|
||||||
"room.loweredHand": null,
|
"room.loweredHand": null,
|
||||||
"room.extraVideo": null,
|
"room.extraVideo": null,
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": "Du bist stummgeschalted, Halte die SPACE-Taste um zu sprechen",
|
"me.mutedPTT": "Du bist stummgeschalted, Halte die SPACE-Taste um zu sprechen",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": null,
|
"room.raisedHand": null,
|
||||||
"room.loweredHand": null,
|
"room.loweredHand": null,
|
||||||
"room.extraVideo": null,
|
"room.extraVideo": null,
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": null,
|
"me.mutedPTT": null,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": null,
|
"room.raisedHand": null,
|
||||||
"room.loweredHand": null,
|
"room.loweredHand": null,
|
||||||
"room.extraVideo": null,
|
"room.extraVideo": null,
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": null,
|
"me.mutedPTT": null,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": "{displayName} raised their hand",
|
"room.raisedHand": "{displayName} raised their hand",
|
||||||
"room.loweredHand": "{displayName} put their hand down",
|
"room.loweredHand": "{displayName} put their hand down",
|
||||||
"room.extraVideo": "Extra video",
|
"room.extraVideo": "Extra video",
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": "You are muted, hold down SPACE-BAR to talk",
|
"me.mutedPTT": "You are muted, hold down SPACE-BAR to talk",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": null,
|
"room.raisedHand": null,
|
||||||
"room.loweredHand": null,
|
"room.loweredHand": null,
|
||||||
"room.extraVideo": null,
|
"room.extraVideo": null,
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": null,
|
"me.mutedPTT": null,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": null,
|
"room.raisedHand": null,
|
||||||
"room.loweredHand": null,
|
"room.loweredHand": null,
|
||||||
"room.extraVideo": null,
|
"room.extraVideo": null,
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": null,
|
"me.mutedPTT": null,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": null,
|
"room.raisedHand": null,
|
||||||
"room.loweredHand": null,
|
"room.loweredHand": null,
|
||||||
"room.extraVideo": null,
|
"room.extraVideo": null,
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": "Utišani ste, pritisnite i držite SPACE tipku za razgovor",
|
"me.mutedPTT": "Utišani ste, pritisnite i držite SPACE tipku za razgovor",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": null,
|
"room.raisedHand": null,
|
||||||
"room.loweredHand": null,
|
"room.loweredHand": null,
|
||||||
"room.extraVideo": null,
|
"room.extraVideo": null,
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": null,
|
"me.mutedPTT": null,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": null,
|
"room.raisedHand": null,
|
||||||
"room.loweredHand": null,
|
"room.loweredHand": null,
|
||||||
"room.extraVideo": null,
|
"room.extraVideo": null,
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": null,
|
"me.mutedPTT": null,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": "{displayName} rakk opp hånden",
|
"room.raisedHand": "{displayName} rakk opp hånden",
|
||||||
"room.loweredHand": "{displayName} tok ned hånden",
|
"room.loweredHand": "{displayName} tok ned hånden",
|
||||||
"room.extraVideo": "Ekstra video",
|
"room.extraVideo": "Ekstra video",
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": "Du er dempet, hold nede SPACE for å snakke",
|
"me.mutedPTT": "Du er dempet, hold nede SPACE for å snakke",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": null,
|
"room.raisedHand": null,
|
||||||
"room.loweredHand": null,
|
"room.loweredHand": null,
|
||||||
"room.extraVideo": null,
|
"room.extraVideo": null,
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": null,
|
"me.mutedPTT": null,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": null,
|
"room.raisedHand": null,
|
||||||
"room.loweredHand": null,
|
"room.loweredHand": null,
|
||||||
"room.extraVideo": null,
|
"room.extraVideo": null,
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": null,
|
"me.mutedPTT": null,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": null,
|
"room.raisedHand": null,
|
||||||
"room.loweredHand": null,
|
"room.loweredHand": null,
|
||||||
"room.extraVideo": null,
|
"room.extraVideo": null,
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": null,
|
"me.mutedPTT": null,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": null,
|
"room.raisedHand": null,
|
||||||
"room.loweredHand": null,
|
"room.loweredHand": null,
|
||||||
"room.extraVideo": null,
|
"room.extraVideo": null,
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": null,
|
"me.mutedPTT": null,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
"room.raisedHand": null,
|
"room.raisedHand": null,
|
||||||
"room.loweredHand": null,
|
"room.loweredHand": null,
|
||||||
"room.extraVideo": null,
|
"room.extraVideo": null,
|
||||||
|
"room.overRoomLimit": null,
|
||||||
|
|
||||||
"me.mutedPTT": null,
|
"me.mutedPTT": null,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -247,6 +247,8 @@ module.exports =
|
||||||
// When truthy, the room will be open to all users when as long as there
|
// When truthy, the room will be open to all users when as long as there
|
||||||
// are allready users in the room
|
// are allready users in the room
|
||||||
activateOnHostJoin : true,
|
activateOnHostJoin : true,
|
||||||
|
// When set, maxUsersPerRoom defines how many users can join a single room. If not set, there is not limit.
|
||||||
|
// maxUsersPerRoom : 20,
|
||||||
// Mediasoup settings
|
// Mediasoup settings
|
||||||
mediasoup :
|
mediasoup :
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,9 @@ class Room extends EventEmitter
|
||||||
peer.roles.some((role) => accessFromRoles.BYPASS_ROOM_LOCK.includes(role))
|
peer.roles.some((role) => accessFromRoles.BYPASS_ROOM_LOCK.includes(role))
|
||||||
)
|
)
|
||||||
this._peerJoining(peer);
|
this._peerJoining(peer);
|
||||||
|
else if ('maxUsersPerRoom' in config &&(this._getJoinedPeers().length + this._lobby.peerList().length) >= config.maxUsersPerRoom) {
|
||||||
|
this._handleOverRoomLimit(peer);
|
||||||
|
}
|
||||||
else if (this._locked)
|
else if (this._locked)
|
||||||
this._parkPeer(peer);
|
this._parkPeer(peer);
|
||||||
else
|
else
|
||||||
|
|
@ -188,6 +191,11 @@ class Room extends EventEmitter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_handleOverRoomLimit(peer)
|
||||||
|
{
|
||||||
|
this._notification(peer.socket, 'overRoomLimit');
|
||||||
|
}
|
||||||
|
|
||||||
_handleGuest(peer)
|
_handleGuest(peer)
|
||||||
{
|
{
|
||||||
if (config.activateOnHostJoin && !this.checkEmpty())
|
if (config.activateOnHostJoin && !this.checkEmpty())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue