feat(#25): Add ability to kick a user

This commit is contained in:
Josh Creek
2024-01-05 18:52:34 +00:00
parent 397aa528dc
commit 6ae45d9c6a
4 changed files with 118 additions and 2 deletions
+9
View File
@@ -66,6 +66,15 @@ export class Room {
return null;
}
getWebSocketByUserId(userId: String): WebSocket | null {
for (const [ws, u] of this.users) {
if (u.userId === userId) {
return ws;
}
}
return null;
}
broadcast(message: any) {
this.users.forEach((user, client) => {
if (client.readyState === WebSocket.OPEN) {