The following diagram is a basic representation of a web application I am creating.
The basic operation of the application is as follows:
- Client sends request for data from node.js server
- Server receives request.
- Server fetches data from database.
- Server sends data back to client as JSON string.
- Client receives data stores it as a JSON object and binds it to a table.
This all works fine. The problem I am having is best represented by the following situation.
- Clients 1 to 4 all complete the steps above (i.e. all have an table of data binded to a JSON object).
- Client 1 now sends an update request to the server.
- Server receives request.
- Server updates database.
- Server sends response to client 1 indicating successful operation and updates JSON object binded to table.
- THE PROBLEM JSON data shown on clients 2 to 4 is now no longer in sync with the database.
So my question is how do I keep the JSON data on all 4 (or more) of my clients in real-time sync with the database on my Node.js server?
