Answer the question
In order to leave comments, you need to log in
How to build reactive client observation of the server's data model?
Example. On Angular 2+, you can separately describe the model (services) and hang up the monitoring of properties in the template (components). And how can you transfer this logic to the server without unnecessary movements? Thus, it will be possible to observe the operation of the same application from different open windows, while the business models are hidden from the client side. Are there ready-made solutions or proven approaches for this task?
Answer the question
In order to leave comments, you need to log in
In what form do you have a "server data model"? Is it a database or just the values of variables in memory?
In the first case, the database can be monitored using the LISTEN / NOTIFY mechanism in PostgreSQL. For example: 1 , 2 , 3 .
In the second case, there seems to be no solution, since the code can safely change the values of any (non-constant) variables without notifying anyone.
The data model is most likely a model of type orm.
In order to track changes, you need to set model values strictly through setters.
The bottom line is this: you and the client keep a permanent web socket connection, when the data changes, the setter is processed, the code of which describes the behavior of sending data to a specific client through the same web socket.
On the client, the behavior of processing the received data is described.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question