1
So I was thinking of picking up the user table where the status = online, I put by default "Offline" , but I know that when the user shuts down the computer without clicking Log out, the table will not be changed for offline, then I want to know what’s best:
DATETIME
TIMESTAMP
Which ones do you recommend me? I want to do data with "Last activity" where if it does any action that involves $_GET or $_POST updates the table status (I will convert to TIMESTAMP or DATETIME) to X minutes ago or something like that, I want examples so I won’t put my DATABASE in question here. Grateful for all opinions, and commented examples.
(I still don’t understand how services like Gmail, Facebook and others make this relationship between offline and online, so if someone also has the good will to explain this, welcome)
the logic is simple, as you can see in the answers below.. The problem is the technique used. Many use asynchronous requests via ajax from the client side. This causes a congestion of requests when the site has a considerable volume of unique access. Depending on the device that accesses, for example, an iPhone, the device heats up in less than 1 minute. The recommendation is to use long pooling. Search on Node.js
– Daniel Omine