How can Meteor apps work offline?

Yes! This is already implemented in Meteor, for the most part.

If the connection to the server is lost, the client can still function locally. Database writes will appear to succeed on the client and reflect instantly on the screen. Once the connection is re-established Meteor will re-send all the pending method requests to the server and update the client display with the results from the server. This is all the result of latency compensation, being offline is treated like the server just being very slow.

Clients can monitor the reactive ‘Meteor.status()’ output to see the status of the current connection. For example you could use Meteor.status to drive a popup with a reconnect timer and a ‘connect now’ button, like gmail.

EDIT: of course, Meteor isn’t magic. If you hit ‘reload’, or navigate away from the page, etc, while offline you’ll lose your Meteor session and not being able to start again until you regain network. This is true of all web apps with offline mode, though, so it shouldn’t come as a surprise to users of your app.

Leave a Comment