Add global presence heartbeat and online tracking
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
(function startPresenceHeartbeat() {
|
||||
const ping = function () {
|
||||
fetch("/api/presence/ping", {
|
||||
method: "POST",
|
||||
credentials: "same-origin",
|
||||
keepalive: true,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: "{}",
|
||||
}).catch(function () {
|
||||
// ignore network issues; next interval will retry
|
||||
});
|
||||
};
|
||||
|
||||
ping();
|
||||
setInterval(ping, 15000);
|
||||
})();
|
||||
Reference in New Issue
Block a user