I'm doing an application, where it has a jobs registry in SQLite that should be synchronized with the server in PHP with Mysql.
After searching a lot, I could not find any answers that solve my question.
I'm basing my sync on Incremental mode as this answer suggests. link
So for example, when the user finishes the registration, the application inserts the data into Sqlite, and creates a data version, and at the same time already tries to communicate with the server to send the inserted data. When it arrives on the server PHP queries if the version is newer, and changes the data and sends the completion response to the application.
Just as you demonstrate in this animation:
Sofareverythingisfineandworking.
Nowmyproblemisinofflinemodeandwhentheconnectiondropsinthemiddleofthesynchronization.
Forexample.Iregisteranewitem,IcreateaversionofdataonmymobileevenwhenI'moffline.WhenIconnect,Ineedtoknowhowtheapplicationdetectsthatthereisstilldatathatwasnotsent.
Andwhenthedataissent,buttheconnectionfallsinthemiddleofthepath.Howcanmyapplicationknowthatdatastillneedstobeanswered?
Theproblemwouldlooksomethinglikethis:
And, after the crash, the application will not be able to try to enter the data again, because the version on the server will already be updated, and will not return an update response.
Did you understand? I do not know if I could explain it correctly.
My problem is being logically resolved when this type of error occurs.
I am very grateful if someone can give me a light without negativizing me. I do not know another way to ask this question.