Skip to content

Commit

Permalink
fix: for..of in disconnecting event
Browse files Browse the repository at this point in the history
  • Loading branch information
arnostpleskot committed Jul 13, 2023
1 parent 49bf529 commit 1ed0fe0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ try {

socket.on("disconnecting", async () => {
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(
(_socket) => _socket.id !== socket.id,
(_socket) => {
return _socket.id !== socket.id;
},
);

if (otherClients.length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "es2020",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
Expand Down

0 comments on commit 1ed0fe0

Please sign in to comment.