I have an existing web application on the standard PHP/Apache platform. Now, what I want is to add chat functionality, and I want it to be real-time over a websocket, and to that extend I've studied socket.io on nodejs a little bit. So in addition to Apache running the big PHP app, I would have nodejs with socket.io running chat.
But what I don't really understand, is how would I recognise my users in the code for nodejs chat? For one, Apache and nodejs won't be able to run on the same port, meaning I'll run chat on port 8080
for example, in which case I lose the user's cookies, which then means I now have to ask them to log in once more on this nodejs-powered port if they want to use chat? Seems ridiculous, but I don't know which way to go about it.
I cannot port my entire code onto nodejs, of course. So ideally I would want Apache and nodejs to coexist. Or I am just completely misunderstanding how chat is supposed to work in web apps.
Any tips appreciated.