I want to keep a table in sync between various clients and I'm almost sure that this is a thing but I don't know the name of the service I need.
User A and user B are visiting the same web page and the page shows a table with data queried from a DB.
User B inserts a new record or updates a record.
Is there a way for me to update the table for user A without the need for user A to manually refresh? I can use pub/sub but it's some work and I was wondering if there is a simpler way...
Merci!
CodePudding user response:
De rien!
Whatever simpler way you choose, you will need to update the values dynamically through JavaScript. So as user B has changed the record, and you have used pub/sub, or the data is on firestore, or whatever database you are using; once the events or query listeners have fired in the client of user A, you simply update the value in user A's client, through JavaScript, so that user A gets to see the new change.
You may appreciate Firebase Firestore that has this synchronizing feature "auto-embedded". You will need to set snapshot changes and you are good. One thing is your table data has to be accessed in a NoSQL method, that is as collections and documents since that is how data is structured in Firestore.