File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 99< body >
1010 < h2 > Socket.IO Client Test</ h2 >
1111 < script > // dummy token. just for test purpose.........
12- const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwiaWF0IjoxNzQ1MDYxMjA4LCJleHAiOjE3NDUwNjQ4MDh9.qv1P4QHlIjwqy_8YFq1OLK7Bg_-RHxfapr6Bkcy24KI " ;
12+ const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwiaWF0IjoxNzQ4NTE2MzMxLCJleHAiOjE3NDg1MTk5MzF9.3eDphhgsSZ9drk9Ww-6muUIZmnsxMW7byj2fdJPIUw0 " ;
1313 const socket = io ( "http://localhost:3000" , {
1414 auth : {
1515 token : token
Original file line number Diff line number Diff line change @@ -37,6 +37,13 @@ export const initializeSocket = (server: Server): SocketIOServer => {
3737 socket . join ( `user-${ uid } ` ) ;
3838 console . log ( `🧑💻 Socket ${ socket . id } registered for user ${ uid } ` ) ;
3939
40+ socket . on ( "send_notification" , ( data ) => {
41+ console . log ( "📩 Received notification:" , data ) ;
42+
43+ // Optionally, emit back to the same socket or room for confirmation
44+ socket . emit ( "notification_ack" , { status : "received" , original : data } ) ;
45+ } ) ;
46+
4047 socket . on ( "disconnect" , ( ) => {
4148 userSocketMap . get ( uid ) ?. delete ( socket . id ) ;
4249 if ( userSocketMap . get ( uid ) ?. size === 0 ) {
You can’t perform that action at this time.
0 commit comments