refactor: improve websocket log
This commit is contained in:
parent
ee72f74e2c
commit
b44e57dde8
@ -29,6 +29,11 @@ export function initSocketio(httpServer: HTTPServer) {
|
||||
|
||||
if (token) {
|
||||
user = jwtVerify(token);
|
||||
logger.info(
|
||||
'[WebSocket] Authenticated via JWT:',
|
||||
user.id,
|
||||
user.username
|
||||
);
|
||||
} else {
|
||||
const session = await getAuthSession(
|
||||
socket.request,
|
||||
@ -43,10 +48,13 @@ export function initSocketio(httpServer: HTTPServer) {
|
||||
username: session.user.name,
|
||||
role: session.user.role,
|
||||
};
|
||||
logger.info(
|
||||
'[WebSocket] Authenticated via Session:',
|
||||
user.id,
|
||||
user.username
|
||||
);
|
||||
}
|
||||
|
||||
logger.info('[Socket] Authenticated via JWT:', user.id, user.username);
|
||||
|
||||
socket.data.user = user;
|
||||
socket.data.token = token;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user