Simple limit connexion in room
This commit is contained in:
parent
cad94c7982
commit
3a565362a2
3 changed files with 10 additions and 0 deletions
|
@ -10,6 +10,7 @@ import {ViewportInterface} from "_Model/Websocket/ViewportMessage";
|
|||
import {Movable} from "_Model/Movable";
|
||||
import {extractDataFromPrivateRoomId, extractRoomSlugPublicRoomId, isRoomAnonymous} from "./RoomIdentifier";
|
||||
import {arrayIntersect} from "../Services/ArrayHelper";
|
||||
import {MAX_USERS_PER_ROOM} from "../Enum/EnvironmentVariable";
|
||||
|
||||
export type ConnectCallback = (user: User, group: Group) => void;
|
||||
export type DisconnectCallback = (user: User, group: Group) => void;
|
||||
|
@ -108,6 +109,10 @@ export class GameRoom {
|
|||
}
|
||||
}
|
||||
|
||||
get isFull(): boolean {
|
||||
return this.users.size >= MAX_USERS_PER_ROOM;
|
||||
}
|
||||
|
||||
public isEmpty(): boolean {
|
||||
return this.users.size === 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue