Answer the question
In order to leave comments, you need to log in
How to find out how many people are authorized on the site?
Good afternoon.
It is necessary to implement the functionality of how many people are currently on the site.
That is, specialists are sitting on the site, you need to display the number of how many people actually sit on the site online or are simply authorized.
The site is written in Laravel.
Answer the question
In order to leave comments, you need to log in
you make a js script that pokes a user with a wand every N minutes - isn't it dead? and sends the data to the server
If you need to monitor how many authorized users are online now, then you can write somewhere (for example, in Redis) the user ID and the time of his last page view, then select the number of users who viewed pages no later than 5 minutes ago.
For unauthorized ones, you can do about the same thing, only identify them by hash from user-agent+IP.
take a centrifuge (web sockets), set the config to join_leave = true, now you can instantly get the actual number of people on the site as soon as a person closes or opens a tab.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question