How to deal with intermitent connectivity in Meteor mobile apps?


If you open a Meteor webapp and the Internet connectivity is poor the data won’t load for obvious reasons. On the web, once your Internet gets better you can simply refresh the page and then you’ll get your Meteor webapp to load again and fetch all the data from the server.

But on Cordova apps you can’t just refresh the page. I had a play with a simple Meteor app in Cordova, and noticed that if I opened the app with airplane mode on (think of a user entering a train tunnel) no data shows, and then when I reconnect the phone to the Internet, still no data is shown in the app.

So it seems Meteor doesn’t keep on trying to fetch the data if it fails the first time.

Not sure then how to approach using it on a mobile app. On both iOS and Android people keep the apps open for long, so if the user didn’t have good connection when opening it the first time, it seems the app will just not fetch the data.

Any thoughts?


Meteor will wait a little longer each time it tries to reconnect (5s, 10s, 20s, 60s… until something like 300s). So when you go back to your app after some time you may have to wait before Meteor actually retries.
So for my app I use a combination of different things:

  • a package to alert user when connection is lost and allow him/her to retry (disclaimer, I am the author of the package) this package also doesn’t alert at the first retry to avoid showing the message too often when having a bad connection.
  • a Meteor.reconnect() on the resume Cordova event: document.on('resume', function(){ Meteor.reconnect(); }); to force reconnect when the app is bring in foreground
  • GroundDB to keep some data in the cache

Maybe there are other ways I am not aware of!


I also use that package. works great! It’s the only one that works out of the box.


Thanks @255kb for explaining how Meteor works it out and for making that
package! Will have a play with it.


Hi, wondering if you’re still using this approach and wondering if you continues using grounddb (with Meteor 1.3 or 1.4)?

I am thinking the cached offline (grounddb) is probably my best bet to keep users unhappy with having to wait a few seconds for the server to reconnect?