19 lines
409 B
JavaScript
19 lines
409 B
JavaScript
(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);
|
|
})();
|