Reputation: 3915
This is more of an asking for an advice
question. I am trying to implement the web version of my mobile chat app. But as HTML,CSS,JS are the main tools in browsers and there is no local database to temporarily store chat messages on client's UI.
Like in the mobile, all of my notifications, messages and everything are stored in tables and I can query the database whenever user opens up the chat activity(Android), find all the messages related to this user and display it inside the app's display.
What can be the best way to store chat messages as JS objects in client's UI and quickly find what's needed?
The JS structure should also be easy to find messages by name
,time
,status
etc.
I am trying to implement something very similar to WhatsApp Web.
Upvotes: 0
Views: 1524
Reputation: 15903
I would look into https://github.com/knadh/localStorageDB. But to be honest it's something I wouldn't do because there is always a security concern. Someone may gain access to your computer and steal the chat data or some malware may get into your computer.
It wouldn't be hard to just query the database for all the chat data when the user loads the web-page. Of course you would use pagination instead of just grabbing everything.
Good luck.
Upvotes: 1