meteor-smart-disconnect
meteor-smart-disconnect copied to clipboard
New version of Chrome no longer fires 'visibilitychange' coming from background tabs
Starting Chrome 77 in Android (to follow in other platforms), background tabs are being "frozen" after 5 minutes of inactivity. When that tab becomes active, the event visibilitychange
is no longer being fired. Instead, the new event resume
is being used.
More details here: https://developers.google.com/web/updates/2018/07/page-lifecycle-api
@rj-david does that mean this package no longer works?
I think this package stopped working a long time ago https://github.com/mixmaxhq/meteor-smart-disconnect/issues/10
@mattmcegg it was working until the new version of chrome (77). It will disconnect but if the tab was inactive for more than 5 minutes, it will not reconnect because a new lifecycle method is being called for that case
Wouldn't simply adding these two lines at startup solve it?
document.addEventListener('resume', Meteor.reconnect())
document.addEventListener('freeze', Meteor.disconnect())