Mobile browsers not reconnecting automatically when in the background for a long time

Seems like mobile browsers, when placed into a background for a long time e.g. 15 minutes, are not triggering the events of visibilitychange or focus automatically even the browser/tab becomes active. Therefore, we cannot trigger Meteor to reconnect using Meteor.reconnect()

(we disconnect our apps after a few seconds when the visibility of the app becomes hidden)

Anybody who found an elegant solution for this?

Our current solution is (1) display a manual reconnect bar to the user: or (2) add a Meteor.reconnect() call when the user changes a route

Both are not ideal as the app should reconnect automatically once the browser becomes active. But seems like there is no browser event that we can hook into for this to happen

Found the answer. There are now two new events: resume and freeze
https://wicg.github.io/page-lifecycle/

This package is no longer enough to keep the meteor app connected:

3 Likes

This is now implemented in Google Chrome for Android. Chrome plans to implement this in all platforms. They are also pushing this to be implemented to all modern browsers

1 Like