Reputation: 8901
I'm using FOS Rest Bundle and I'd like to show which users are online in the website. I don't know (I couldn't find any info about it) if there's a way to query the database and get if a user is currently online or not.
Is there a way to know this or any other bundle that could provide this info?
Thanks in advance
Upvotes: 0
Views: 266
Reputation: 717
Add a "lastActivity" (datetime) attribute in your User class and use an event for update the date of this field everytime the user do an action on the site.
After that, just get all online user in last x minutes with a simple doctrine query on this field.
Upvotes: 1