I have a multipage website (atm, that also means sockets open and close with every http request), and after the user logs in, i need to somehow link the socket to his user _id (mongodb), in order to be able to send private messages in realtime, and update other parts of the website just for that user.
Currently when a user logs in, his details are stored in the express session variables. Is there an easy way to read the express session with socket? I have looked on other questions on this topic, but couldnt get that to work.
Would there be any other suggestions? Of course i could make the website a single page, which would prevent sockets from opening and closing so often, but that still doesnt solve the identification of every socket.
Thanks!