From b09e2d1fc9ac25fa448b76bc6d73996ce400e2f7 Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 24 Mar 2025 14:56:06 +0100 Subject: [PATCH] feat(assist): debug logs for new connections --- assist/utils/socketHandlers.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/assist/utils/socketHandlers.js b/assist/utils/socketHandlers.js index 67e47cdab..4d9d0ed56 100644 --- a/assist/utils/socketHandlers.js +++ b/assist/utils/socketHandlers.js @@ -73,6 +73,8 @@ function processNewSocket(socket) { logger.debug(`connProjectKey:${connProjectKey}, connSessionId:${connSessionId}, connTabId:${connTabId}, roomId:${socket.handshake.query.roomId}`); } +const projectToTrack = process.env.projectToTrack || "95"; + async function onConnect(socket) { logger.debug(`WS started:${socket.id}, Query:${JSON.stringify(socket.handshake.query)}`); processNewSocket(socket); @@ -81,6 +83,17 @@ async function onConnect(socket) { const {tabsCount, agentsCount, tabIDs, agentIDs} = await getRoomData(socket.handshake.query.roomId); + // + let debugLogs = false; + if (socket.handshake.query.identity === IDENTITIES.session) { + debugLogs = projectToTrack == socket.handshake.query.sessionInfo?.projectID; + } else if (socket.handshake.query.identity === IDENTITIES.agent) { + debugLogs = projectToTrack == String(socket.handshake.query.projectId); + } + if (debugLogs) { + logger.info(`[+] new connection, sessionID: ${socket.handshake.query.sessId}, type: ${socket.handshake.query.identity}`); + } + if (socket.handshake.query.identity === IDENTITIES.session) { // Check if session with the same tabID already connected, if so, refuse new connexion if (tabsCount > 0) {