Slow down updates when tab is in background
aalin opened this issue · 0 comments
aalin commented
Listen to the visibilitychange-event and notify the server when it happens.
Pseudo-code:
document.addEventListener("visibilitychange", () => {
postCallback(sessionId, "visibilitychange", document.visibilityState);
});
And then on the server, the session could reduce the rate of updates, maybe do them once per second, or maybe even wait a longer time if the tab has been left in the background for a while.
This would reduce server load and network traffic when tabs are left in the background.