From 77a76262f5ae063fbda6db20227eadc17cfff2dd Mon Sep 17 00:00:00 2001 From: Vantz Stockwell Date: Fri, 13 Mar 2026 14:27:43 -0400 Subject: [PATCH] debug: add verbose WebSocket logging to terminal gateway Need to see if handleConnection is even being called. Co-Authored-By: Claude Opus 4.6 --- backend/src/terminal/terminal.gateway.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/terminal/terminal.gateway.ts b/backend/src/terminal/terminal.gateway.ts index 958d40f..f2e8a7b 100644 --- a/backend/src/terminal/terminal.gateway.ts +++ b/backend/src/terminal/terminal.gateway.ts @@ -16,19 +16,23 @@ export class TerminalGateway implements OnGatewayConnection, OnGatewayDisconnect ) {} handleConnection(client: any, req: any) { + this.logger.log(`[WS] handleConnection fired, req.url=${req?.url}, client.url=${client?.url}`); const user = this.wsAuth.validateClient(client, req); if (!user) { + this.logger.warn(`[WS] Auth failed — closing 4001`); client.close(4001, 'Unauthorized'); return; } this.clientSessions.set(client, []); - this.logger.log(`Terminal WS connected: ${user.email}`); + this.logger.log(`[WS] Terminal connected: ${user.email}`); client.on('message', async (raw: Buffer) => { try { const msg = JSON.parse(raw.toString()); + this.logger.log(`[WS] Message: ${msg.type} ${JSON.stringify(msg).substring(0, 200)}`); await this.handleMessage(client, msg); } catch (err: any) { + this.logger.error(`[WS] handleMessage error: ${err.message}\n${err.stack}`); this.send(client, { type: 'error', message: err.message }); } });