Now I do this: every time I load the page, I update the key " {$user->id}.online " in the {$user->id}.online for 5 minutes. If there is no key, the user is offline.
This method is good when you need to check a particular user by knowing his id . But how to get all users online? We have to load all users (for the time being, there are not many of them) and check " {$user->id}.online " for {$user->id}.online . It's horrible. Is there a better way?
SignalR, look towards similar php solutions . there asynchronous requests to the server are sent from the client during connection / disconnect. As a result, it was possible to receive when a new person arrived, or the client moved to another page, or he ended the session. The data went in both directions. That is, when you change the number of people, all customers received a notification. - teran