Skip to content

Commit

Permalink
Update keepalive.js
Browse files Browse the repository at this point in the history
  • Loading branch information
essenciary authored Oct 23, 2024
1 parent 5f07c1e commit 1eccc42
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion assets/js/keepalive.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@
*/

function keepalive() {
if (window._lastMessageAt !== undefined) {
if (Date.now() - window._lastMessageAt < Genie.Settings.webchannels_keepalive_frequency) {
return
}
}

if (Genie.Settings.env == 'dev') {
console.info('Keeping connection alive');
}

Genie.WebChannels.sendMessageTo(CHANNEL, 'keepalive', {
'payload': {}
});
}
}

0 comments on commit 1eccc42

Please sign in to comment.