This commit is contained in:
Louis Lam
2023-12-25 01:52:00 +08:00
parent 7d91c8d037
commit 0c32171acc
7 changed files with 324 additions and 271 deletions

View File

@@ -663,10 +663,10 @@ export class DockgeServer {
* @param {string} userID
* @param {string?} currentSocketID
*/
disconnectAllSocketClients(userID: number, currentSocketID? : string) {
disconnectAllSocketClients(userID: number | undefined, currentSocketID? : string) {
for (const rawSocket of this.io.sockets.sockets.values()) {
let socket = rawSocket as DockgeSocket;
if (socket.userID === userID && socket.id !== currentSocketID) {
if ((!userID || socket.userID === userID) && socket.id !== currentSocketID) {
try {
socket.emit("refresh");
socket.disconnect();