@@ -23,7 +23,7 @@ const notifyOnQueue = (io: InnkeeperIoServer, inn: InnState, socket: InnkeeperIo
23
23
} ;
24
24
25
25
export const handleConnect = ( io : InnkeeperIoServer , inn : InnState , socket : InnkeeperIoSocket ) : void => {
26
- SHOULD_LOG && console . log ( `User ${ socket . data ?. userId } connected to lobby.` ) ;
26
+ SHOULD_LOG && console . log ( `[LOBBY][Q] User ${ socket . data ?. userId } connected to lobby.` ) ;
27
27
const waitingUsers = inn . getWaitingUsers ( ) ;
28
28
socket . join ( 'lobby' ) ;
29
29
socket . emit ( 'availableMatches' , waitingUsers ) ;
@@ -38,20 +38,20 @@ export const handleMatchingRequest = (
38
38
socket . data . lastMessage = getUnixTimestamp ( ) ;
39
39
const { userId, displayName, imageUrl } = socket . data ;
40
40
41
- SHOULD_LOG && console . log ( `User ${ displayName } (${ userId } ) requested a match with parameters ${ JSON . stringify ( params ) } .` ) ;
41
+ SHOULD_LOG && console . log ( `[LOBBY][Q] User ${ displayName } (${ userId } ) requested a match with parameters ${ JSON . stringify ( params ) } .` ) ;
42
42
43
43
// Remove user from queue in case this is a re-request.
44
44
inn . removeUserFromQueue ( { userId, displayName, imageUrl } ) ;
45
45
46
46
const maybeMatch = inn . queueUserOrReturnMatchResult ( { userId, displayName, imageUrl } , params ) ;
47
47
if ( ! maybeMatch ) {
48
48
notifyOnQueue ( io , inn , socket ) ;
49
- SHOULD_LOG && console . log ( `User ${ userId } added to queue.` ) ;
49
+ SHOULD_LOG && console . log ( `[LOBBY][Q] User ${ userId } added to queue.` ) ;
50
50
return ;
51
51
}
52
52
53
53
const [ otherUserId , roomState ] = maybeMatch ;
54
- SHOULD_LOG && console . log ( `Matched users ${ userId } and ${ otherUserId } in room ${ roomState . roomId } .` ) ;
54
+ SHOULD_LOG && console . log ( `[LOBBY][Q] Matched users ${ userId } and ${ otherUserId } in room ${ roomState . roomId } .` ) ;
55
55
56
56
io . in ( 'lobby' )
57
57
. fetchSockets ( )
@@ -67,12 +67,12 @@ export const handleMatchingRequest = (
67
67
otherSocket . data . roomId = roomState . roomId ;
68
68
otherSocket . emit ( 'sendToRoom' , roomState . roomId ) ;
69
69
joinAssignedRoom ( io , inn , otherSocket ) ;
70
- SHOULD_LOG && console . log ( `Sent users ${ userId } and ${ otherUserId . userId } to room ${ roomState . roomId } .` ) ;
70
+ SHOULD_LOG && console . log ( `[LOBBY][Q] Sent users ${ userId } and ${ otherUserId . userId } to room ${ roomState . roomId } .` ) ;
71
71
return ;
72
72
}
73
73
74
74
// socket with matching otherUserId could not be found, remove from queue.
75
- console . error ( `Could not find socket for userId ${ otherUserId } (returned from queue).` ) ;
75
+ console . error ( `[LOBBY][Q] Could not find socket for userId ${ otherUserId } (returned from queue).` ) ;
76
76
inn . removeUserFromQueue ( otherUserId ) ;
77
77
78
78
inn . addUserToQueue ( { userId, displayName, imageUrl } , params ) ;
@@ -84,5 +84,5 @@ export const handleDisconnect = (io: InnkeeperIoServer, inn: InnState, socket: I
84
84
const { userId, displayName, imageUrl } = socket . data ;
85
85
inn . removeUserFromQueue ( { userId, displayName, imageUrl } ) ;
86
86
87
- SHOULD_LOG && console . log ( `User ${ userId } disconnected from queue.` ) ;
87
+ SHOULD_LOG && console . log ( `[LOBBY][Q] User ${ userId } disconnected from queue.` ) ;
88
88
} ;
0 commit comments