debug: add verbose WebSocket logging to terminal gateway
Need to see if handleConnection is even being called. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c4d7ad1833
commit
77a76262f5
@ -16,19 +16,23 @@ export class TerminalGateway implements OnGatewayConnection, OnGatewayDisconnect
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
handleConnection(client: any, req: any) {
|
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);
|
const user = this.wsAuth.validateClient(client, req);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
|
this.logger.warn(`[WS] Auth failed — closing 4001`);
|
||||||
client.close(4001, 'Unauthorized');
|
client.close(4001, 'Unauthorized');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.clientSessions.set(client, []);
|
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) => {
|
client.on('message', async (raw: Buffer) => {
|
||||||
try {
|
try {
|
||||||
const msg = JSON.parse(raw.toString());
|
const msg = JSON.parse(raw.toString());
|
||||||
|
this.logger.log(`[WS] Message: ${msg.type} ${JSON.stringify(msg).substring(0, 200)}`);
|
||||||
await this.handleMessage(client, msg);
|
await this.handleMessage(client, msg);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
this.logger.error(`[WS] handleMessage error: ${err.message}\n${err.stack}`);
|
||||||
this.send(client, { type: 'error', message: err.message });
|
this.send(client, { type: 'error', message: err.message });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user