The following diagram is a basic representation of a web application I am creating.
The basic operation of the application is as follows:
This all works fine. The problem I am having is best represented by the following situation.
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?
Briefly, what you need is to notify clients when something has changed. Try looking for websockets, there are lots of good tutorial on the web. Basicaly, a websocket is a communication channel between server and clients., what you should do is to send a notification to the client about what has changed, then each client should determine if it has to update something (and request the information) or not.
Take a look a this lib:https://www.npmjs.com/package/websocket
I think it is one of the best (if it is not the best) and you will even find examples and demos.