I need to know how I can get if a specific user in symfony is logged in the application, is there a way to get the session id for the current users logged?
I've tried with a table when I have a field named is_online
and y set it when the user loggin and logout on the application, so I get a problem when a user close the brower or when the session end, so the field is_online
stay true. That is the reason for that I need another way to get if an user is logged on the application.
Any advice will be useful.
Create a database field like
lastonlinetstamp
and aping
method in ajax which calls a service with the same session every minute. Then let the ping service update thelastonlinetstamp
. If this value is older than 1 minute you know the user is offline. But: This will increase the number of requests to your server.