ref: add logs
This commit is contained in:
parent
e2322b7e2d
commit
6b529bef20
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user