Hi everyone! I’m trying to understand how to setup a reactive Web app that would be able to sync data from multiple users in real-time with central database persistence. Imagine a user sees a list of items and modifies one of them; all the other users who were visualizing the same data get an instant update in real-time.
Here’s my thinking on this so far…
- Users subscribe to specified data on their respective client app
- Server sends a specific database query result to these clients
["item1" "item2" ...]
- Clients store the data in local state
- Clients select a specific part of the local state to display
- A user updates a field on the UI, which fires an event
- Event handler on client both…
… changes the app local state
… sends a message to the server to update the central database
- Server gets the update message and both…
… commits the change to the database
… sends a notification to all concerned data publishers
- Publishers send the subscribed clients only the change that occured (description of item 1 is now “ModifiedItem”)
- Subscription on each client handles the incoming changes by updating the local app state
- All clients’ UI changes reactively to show the updated local state and displays the new list
["ModifiedItem" "Item2" ...]
And on and on… I could be completely wrong on this, so please feel free to correct me.
Is there an existing framework for this kind of process? Otherwise, which libraries would be absolute must for this? Client side UI is not the main difficulty. Re-Frame, Hoplon, Om Next, etc. explain well how to handle this part. The interaction between client and server is my main issue, especially handling publication/subscription.
Thanks in advance!