You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Anytime I visit the homepage at http://localhost:5000 the socket is successfully connected and session contains myData value that is set in socketio initial connection
However when a request is sent to http://localhost:5000/api/download the console output in the Express handler does not contain the myData value in the session.
This indicates that even though socketIO is saving session data, it is not sharing it with Express.
I have searched all over the internet and I can't seem to figure it out. The socketIO documentation is not helpful either.
I also tried other solutions here on stackoverflow but none seems to work.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to share session data between SocketIO and Express on a nodejs server. I researched online the came across how to implement it at https://socket.io/docs/v3/faq/#Usage-with-express-session
NOTE: FRONT-END AND BACK-END CODE AT BOTTOM
Anytime I visit the homepage at http://localhost:5000 the socket is successfully connected and session contains myData value that is set in socketio initial connection
SocketIO Console Output
However when a request is sent to http://localhost:5000/api/download the console output in the Express handler does not contain the myData value in the session.
This indicates that even though socketIO is saving session data, it is not sharing it with Express.
Express Handler Console Output
I have searched all over the internet and I can't seem to figure it out. The socketIO documentation is not helpful either.
I also tried other solutions here on stackoverflow but none seems to work.
This question is my last attempt to find help an solve the problem.
Thank You
MY CODE SET UP FOR BOTH FRONT-END AND BACK-END
FRONT-END:
BACK-END:
Beta Was this translation helpful? Give feedback.
All reactions