W
W
WiNNeR_tig2018-03-31 16:46:33
PHP
WiNNeR_tig, 2018-03-31 16:46:33

How to make the amount online on the site?

How to make the amount online on the site? Partially, some pages are loaded via ajax, the site is self-written. Implemented online by sending an ajax request when navigating through pages, both regular and ajax. But not sure which is correct. I doubt it because the site requires you to stay for a long time, i.e. people work on the site. There are 25 tons of unique visitors per day, but online I see a maximum of 1700 at the peak, and so 1000-1200

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander, 2018-03-31
@alexr64

Unique visitors 25t per day

Per day. Those. total per day.
At the current moment.

S
Stalker_RED, 2018-03-31
@Stalker_RED

What exactly do you need? If the indicator is like "there are 2123 people on the site now", then the easiest way is to write some notes about users in the radish, and recalculate them from time to time.
If you need detailed analytics, you can run access.log through some analyzer, since there are many different ones for all occasions.
In principle, the first task is also solved through analyzers, but perhaps this is too simple.
You can also recalculate the session files, or if the session is in the database, make a query on this table. It also contains the date of the last update.

U
Uncle Deacon, 2018-03-31
@Ezeneria

Through ajax and do it if you can pull out the info. After wrap it all in setInterval and update on the page

V
Vmedmen, 2018-03-31
@qualitat

In my project I use socket.io + redis for such purposes.
Here is a short example in which the variable is incremented by one on connect and decremented on disconnect. You can immediately write the value variable to a radish, for example, or a file cache.

io.on('connection', function (socket) {
        connectCount++;
        socket.on('disconnect', function () {
            connectCount--;
        });
    });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question