I have a simple Chat App which uses Meteor to sync the messages between users. At this stage, all messages are stored on the server in a Mongodb database. It works perfectly.
I do however, want to store the messages on the uses local devise rather, once downloaded from the server, much like WhatsApp does.
Should I user Local Storage or SQLLite?
I am leaning towards Local Storage because the object I save are pretty simple (just a
key and a
I plan to save the messages in simple JSON with a key.
I have never used this before, but understand normal SQL.
The #1 question is “do you care if the data gets deleted out from under you?”. If so, don’t use localstorage.
What do you mean “deleted from under you”? What will delete it? If the user uninstalls and reinstalls the app, then it’s okay if the data is deleted.
If the device runs low on memory, the OS may wipe localstorage. If you can refresh the data, not a problem. If you can’t, you’re better off using SQLite.
Does SQLite only run on a device, and not a browser?
Maybe have a look into PouchDB. It let’s you store data locally and sync to a remote CouchDB server.
Have a look into this tutorial, maybe it gives you new inspiration: