2

I'm using the Firebase JS API in my trigger.io app.

My app must be able to start up and operate in Airplane Mode. Would it be acceptable for me to reference a local copy of the Firebase JS file, or must this always be loaded from the CDN url?

Alternatively, is there a way the file could be cached locally and requested on a scheduled basis to get the latest version, or is there another mechanism I should use that I'm missing out on.

AlanG
  • 43
  • 3

1 Answers1

2

If you referenced a local copy of the firebase.js lib, it would work as well as the remote copy, at least initially. Since Firebase is in beta, changes can be pushed to that lib at any time, making your local copy obsolete.

Utilizing a local copy wouldn't, by itself, solve the issue you are hoping to address. While Firebase will survive temporary outages and spotty coverage, there is no locally stored copy of the data, so you'll need to either connect to Firebase initially and obtain that data, or use set() to create some sort of local default if offline.

More robust offline support is on the Firebase road map.

Some additional and very informative reading can be found here:

Community
  • 1
  • 1
Kato
  • 40,352
  • 6
  • 119
  • 149
  • Thanks Kato, that's a real help. – AlanG Jun 06 '13 at 07:43
  • A few clarifications: (1) We are now guaranteeing that we'll be backwards compatible with the wire protocol. So while we still recommend that you use the one off the CDN, caching it locally will work fine. (2) Depending on what you're doing, offline mode might actually work ok. While we don't currently cache data to disk and we need to load data from the server when apps start up, you can use Firebase without a network connection if you explicitly set() the value of the data. That way we know what the value will be without needing to talk to the server first. (this might be useful for testing) – Andrew Lee Jun 08 '13 at 01:00
  • Thanks Andrew; I've revised my answer to match. – Kato Jun 08 '13 at 18:13