How do I sync data with remote database in case of offline-first applications?

Viewed 8254
  • I am building a "TODO" application which uses Service Workers to cache the request's responses and in case a user is offline, the cached data is displayed to the user.
  • The Server exposes an REST-ful endpoint which has POST, PUT, DELETE and GET endpoints exposed for the resources.
  • Considering that when the user is offline and submitting a TODO item, I save that to local IndexedDB, but I can't send this POST request for the server since there is no network connection. The same is true for the PUT, DELETE requests where a user updates or deletes an existing TODO item

Questions

  • What patterns are in use to sync the pending requests with the REST-ful Server when the connection is back online?
2 Answers
Related