Hello guys,
I am trying to find an answer for my question for months, and I can't be the only one that has this problem.
How do you handle XHR requests properly? How do you store them, or how do you syncronize the app's database with the server if the device is offline, or has a bad connection? I'm searching for a module or wrapper around httpClient for ages. Until now, I am storing the items that will be sent to the server into a table, with a synced column. If the device is online, I make the request. If it fails, I try 3 more times. If it fails, I set the app to offline mode for 1 hour, or until you disable it from settings or I detect a connection change. When in offline mode, no requests are sent, all is done locally. Also when a network change is detected I iterate the table to see what I have to sync. But my method is far from perfect, it fails often.
How do you do it properly? I can't be the only one that has this issue.
Thanks.