ref: add logs

This commit is contained in:
Steve Korshakov 2025-07-12 20:53:36 -07:00
parent e2322b7e2d
commit 6b529bef20

View File

@ -372,6 +372,7 @@ export async function startApi() {
const token = socket.handshake.auth.token as string;
if (!token) {
log({ module: 'websocket' }, `No token provided`);
socket.emit('error', { message: 'Missing authentication token' });
socket.disconnect();
return;
@ -379,11 +380,14 @@ export async function startApi() {
const verified = await tokenVerifier.verify(token);
if (!verified) {
log({ module: 'websocket' }, `Invalid token provided`);
socket.emit('error', { message: 'Invalid authentication token' });
socket.disconnect();
return;
}
log({ module: 'websocket' }, `Token verified: ${verified.user}`);
const userId = verified.user as string;
// Track socket for user