sdelements/lets-chat

When does a user connect and disconnect ?

mmeinert opened this issue · 2 comments

I was asked to discover when a specific user logged in let's chat and I can't find where I may have this information ? I use LDAP for the authentication.

In MongoDB ? I can see sessions but I can't link them to users
In Nginx's access log ? I find things like /socket.io/?EIO=3&transport=polling&t=1511680349141-0 and /socket.io/?EIO=3&transport=polling&t=1511791115736-3&sid=cAzuNdX-8-k8VevhAAJp but can't link those either.

So, is there a way to find out when a user came and leaved the system ?

I'm wondering if some external Node.js modules could be used :

Any idea on how to implement them ?

It's not stored anywhere, but you can probably add some code when a user connects around here:

User.findById(userId, function (err, user) {