I am implementing a synchronization process between two devices. Web and mobile. I have planned an algorithm but not sure about the possibility of its implementation. My algorithm is,
- Mobile will generate a ajax request to PHP script to sync its data onto database.
- PHP scripts starts a transaction, then insert data into to database that mobile sent and collects data that it has to send to mobile and send resposce but do not commit.
- Mobile receives response, starts a transaction, and send another ajax request as acknowledgement to php script and commit at mobile side.
- PHP script receives acknowledgement ajax request and commit its data as well that i developed in setp 2.
My question is, is it possible to use single php thread to work with two synchronous ajax request?