fix: for..of in disconnecting event

This commit is contained in:
Arnošt Pleskot 2023-07-13 14:09:30 +02:00
parent 49bf529ea1
commit 1ed0fe035a
No known key found for this signature in database
2 changed files with 5 additions and 3 deletions

View File

@ -80,9 +80,11 @@ try {
socket.on("disconnecting", async () => { socket.on("disconnecting", async () => {
socketDebug(`${socket.id} has disconnected`); socketDebug(`${socket.id} has disconnected`);
for (const roomID in socket.rooms) { for (const roomID of socket.rooms) {
const otherClients = (await io.in(roomID).fetchSockets()).filter( const otherClients = (await io.in(roomID).fetchSockets()).filter(
(_socket) => _socket.id !== socket.id, (_socket) => {
return _socket.id !== socket.id;
},
); );
if (otherClients.length > 0) { if (otherClients.length > 0) {

View File

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es2020",
"lib": ["dom", "dom.iterable", "esnext"], "lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true, "allowJs": true,
"skipLibCheck": true, "skipLibCheck": true,