File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -13,18 +13,24 @@ export function initializeSocket(server: Server, corsOptions: CorsOptions) {
1313 } ) ;
1414
1515 io . on ( "connection" , ( socket ) => {
16+ console . log ( `New connection created of id ${ socket . id } ` ) ;
1617 socket . on ( "register" , async ( token ) => {
1718 const userId = await getUserIdFromToken ( token ) ;
1819 if ( userId ) {
1920 users . set ( userId , socket ) ;
21+ console . log (
22+ `The user of id ${ socket . id } turned out to have id ${ userId } ` ,
23+ ) ;
2024 } else {
2125 console . log ( "Invalid token or failed to retrieve user ID" ) ;
2226 }
2327 } ) ;
2428
2529 socket . on ( "disconnect" , ( ) => {
30+ console . log ( `A user disconnected of id ${ socket . id } ` ) ;
2631 for ( const [ id , socket2 ] of users . entries ( ) ) {
2732 if ( socket2 . id === socket . id ) {
33+ console . log ( `... whose userId is ${ id } ` ) ;
2834 users . delete ( id ) ;
2935 break ;
3036 }
You can’t perform that action at this time.
0 commit comments