I have a page and I want to track what the current user is doing. For this, the server gives him an id, and than, I'd like to send a XmlHttpRequest to log information, and I'd like to keep its id.
However, the request received by my server as an empty session (when the request starts from a XmlHttpRequest). I thought of serveral solutions
my server could print a little script in js so that the js program knows its id, but I wouldn't like to do it since the client could change its id himself
my server could print a little script in js so that the js program could know the id of its session, and then, send it back to the server which will be able to retrieve the session and thus the id (better, but I still don't like it)
So I have two questions :
is there something I'm missing ? an easy thing to do so my XmlHttpRequest could forward the session to the server ?
if not, is giving the client its session id is a good idea ? and if so, how can I retrieve a session from its id in node.js ?