1

I'm trying to solve the problem with poor internet connection and many times disconnected for a mobile browser app made with the angular framework.

It's like this Book Collection app. Currently, the web app (has a web URL) saves the data directly in Azure table storage in the cloud. Due to the poor internet connection, the app fails to update the cloud storage. When the user visits the web app again using the same URL, the app tries to read the data from Azure table storage, and the updated data is not available.

  • Is LocalStorage a solution to this problem by saving the data locally in the browser? Should the app save the data first in the LocalStorage and then update the Azure storage? In the case of a failure, the data can be read from the local storage.
  • Is there any JavaScript library that supports syncing data between the local storage and the Azure table storage?
  • Should I use the LocalStorage or the Azure Table Storage as the source of truth for the data?
    • Is there a limitation on how much data I can save in Local Storage?
tRuEsAtM
  • 3,517
  • 6
  • 43
  • 83
wonderful world
  • 10,969
  • 20
  • 97
  • 194
  • 2
    http://stackoverflow.com/questions/2989284/what-is-the-max-size-of-localstorage-values This post says around 5 MB to 10 MB of data can be stored in the LocalStorage. (Depends on the browser) – tRuEsAtM Feb 24 '17 at 18:16

1 Answers1

1

Is Local Storage a solution to this problem by saving the data locally in the browser? Should the app save the data first in the Local Storage and then update the Azure storage?

Yes, if you want to build a offline application. You need to save your application data locally and then synchronize the data to the server. Local Storage is a good choice for browser based application to store data at local.

Is there any JavaScript library that supports syncing data between the local storage and the Azure table storage?

Until now, there is no library could handle this for you automatically. You need to redefine the data structure for synchronize your data from local to server. I suggest you add a flag named synced for each record in your local data storage. If a record is synced to server successfully, the value for synced property would be true, otherwise it will be false. You also need to define a sync function for each type of data.

Should I use the Local Storage or the Azure Table Storage as the source of truth for the data?

It depends on the data type. There will be 2 types of data, application data and user data. For example, book information is belong to application data. Whether the user like the book is belong to user information. For user information, I suggest you use Local Storage as the source of truth for the data.

Is there a limitation on how much data I can save in Local Storage?

We can find the limitations from the link that Sameer provide, here is a snippet:

10 MB per origin in Google Chrome(https://plus.google.com/u/0/+FrancoisBeaufort/posts/S5Q9HqDB8bh), Mozilla Firefox, and Opera; 10 MB per storage area in Internet Explorer

Amor
  • 8,325
  • 2
  • 19
  • 21