4

I am using angularfire's sync arrays and the javascript SDK of firebase.I need to download about 5MB of data to fill my array so the app could work offline for a short time if it loses connection. I am afraid that the way I do things, the size of this array can easily bring me a high bill at the end of the month.

What if the user refresh's or starts and stops his/her app 100 times a month? What if 100 users do it? Is there some way to cache the array offline and only apply changes to it after I refresh the app?

4
  • The JavaScript SDK for the Firebase Realtime Database can handle short-term connectivity loss: it keeps the listened-to data in memory and will keep a queue of writes. It can however not survive a page reload. Since this has been asked a few times before, I'll provide some links: 1, 2, 3 Commented Jan 19, 2017 at 14:23
  • If you need to download and maintain 5MB of data that changes frequently and should be updated in real-time, then it's going to be expensive. That's a LOT of JSON data. What is the end goal? Are you trying to cache images locally? There's no way a client needs 5MB of chat messages, for example, locally cached. Also, have you tried storing it in localStorage? There's just not enough here to help you. See how to ask and creating an mcve. Commented Jan 19, 2017 at 17:05
  • I want to download a list of products.Name, price, and several other specification so the user can make sales even if there is no internet for a long time.Products can be 20000 as an example.And i will need the second array with products barcodes which also could be 20000-30000 records with simple 10 character strings.The data wont update frequently.Only the user can make changes to products. Commented Jan 20, 2017 at 12:56
  • Hi @PeterZlatev, I would recommend you to look at cloud function to expose product data (assuming it does not change very frequently) and use cache from your cloud function. Commented Nov 4, 2017 at 6:48

1 Answer 1

1

I suggest that you take a look at AngularFire Offline which I am using for a similar use case within an Ionic hybrid mobile app and so far it looks to handle things well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.