3 ms·
We used a "heartbeat". The client sends a heartbeat every N minutes (default 5, set by server), and the server responds with an acknowledgement. It doesn't int
by muzani 7y ago
We used a "heartbeat". The client sends a heartbeat every N minutes (default 5, set by server), and the server responds with an acknowledgement.
It doesn't interfere with performance much (we scaled it to millions of users). Though the other trick was to use it as a way to bundle cache information.
We also sent it to notify the server whenever it quit the tool. But there are cases where it doesn't (device failure), so the server assumes the person is off when it misses 3 heartbeats.
- thescribbblr 7y agoThank you so much. Can you please the elaborate the entire procedure so that I can achieve the same in my application.
- muzani 7y agoThe easiest way would be to set a timer on the client side every N minutes. If the server hasn't received a heartbeat from the client in 3N or 2N minutes, assume that they're disconnected. Also set a disconnect request whenever the app/site closes.
- thescribbblr 7y agoAwesome! Thank you so much.