I created a simple web application that works completely autonomously - all data is stored in HTML5 localStorage. Now I want the data to be synchronized with the server so that the user can simultaneously use the application on multiple devices.
What i have done so far:
For each operation that the user performs, a log entry is added. When a user is connected to the network, all logs are transferred from localStorage to PHP via AJAX. Corresponding changes have been made to the SQL database. All logs are deleted from localStorage. In this way, all localStorage data is backed up properly on the server.
In any case, changes made from one device are not reflected on the other device and vice versa, for this we will need to get some data from SQL to localStorage.
Now, my question is: what would be the appropriate and best way to do this?
After the four steps above, I
Also, what about timestamps? What if there are conflicts?
coder source
share