From 4733ca51393432449494bdfe1338444ee3347702 Mon Sep 17 00:00:00 2001 From: Hri7566 Date: Mon, 2 Sep 2024 15:17:29 -0400 Subject: [PATCH] Allow notes to be sent to other instances of the same participant on separate sockets --- README.md | 1 + src/channel/Channel.ts | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f0c0f6f..c99640d 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ This has always been the future intention of this project. ## TODO +- Change `socketsBySocketID` to `socketsByUUID` - Channel data saving - Permission groups and permissions - Probable permission groups: owner, admin, mod, trialmod, default diff --git a/src/channel/Channel.ts b/src/channel/Channel.ts index 045a18b..d979a05 100644 --- a/src/channel/Channel.ts +++ b/src/channel/Channel.ts @@ -842,15 +842,17 @@ export class Channel extends EventEmitter { let sentSocketIDs = new Array(); for (const p of this.ppl) { - socketLoop: for (const socket of socketsBySocketID.values()) { - if (socket.isDestroyed()) continue socketLoop; - if (!socket.socketID) continue socketLoop; - if (socket.getParticipantID() != p.id) continue socketLoop; - if (socket.getParticipantID() == part.id) continue socketLoop; - if (sentSocketIDs.includes(socket.socketID)) - continue socketLoop; - socket.sendArray([clientMsg]); - sentSocketIDs.push(socket.socketID); + socketLoop: for (const sock of socketsBySocketID.values()) { + this.logger.debug(`Socket ${sock.getUUID()}`); + if (sock.isDestroyed()) continue socketLoop; + if (!sock.socketID) continue socketLoop; + if (sock.getUUID() == socket.getUUID()) continue socketLoop; + if (sock.getParticipantID() != p.id) continue socketLoop; + //if (socket.getParticipantID() == part.id) continue socketLoop; + if (sentSocketIDs.includes(sock.socketID)) continue socketLoop; + + sock.sendArray([clientMsg]); + sentSocketIDs.push(sock.socketID); } } }