Domanda

My sceneario is like this: I have some tables in a MySQL Database, I connect to it using a PHP web service by JSON-RPC 2.0 protocol. I show the data of those tables on a Desktop App, coded in Java, it's like an Adminitration Tool that is used to make changes (and there is also an Android App which also uses this data). I need to check regularly for changes and show them to the user, the tables have a last_update column. The data in the app is stored on an Array.

How can I get the changes from the last time checked?

È stato utile?

Soluzione

The simplest way would be to make a request to the PHP service with the time of your last read. Then you just query for any tuple (entity) with a last_update time greater than the last request time. This would require both applications to request for changes on an interval (maybe once per second).

The other way would be to create a long running PHP or C++ task that would continually query the database and push the data out via web-sockets. That tends to be harder to support and you quickly run into problems with keeping data "in sync", so you will ultimately end up sending out significantly more data than if the service had requested it on it's own.

** Please advise if this answers your question, or if you need additional details.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top