title: https://www.twilio.com/blog/2017/02/send-messages-
date: 2018/02/16 06:06:43
slug: 16-060643-am
status: published
link: https://jj.isgeek.net/2018/02/16-060643-am/
bookmark_of: https://www.twilio.com/blog/2017/02/send-messages-when-youre-back-online-with-service-workers-and-background-sync.html
titleless: True
display_format: entry
syndication: https://twitter.com/jjdelc/status/964380508149841925


Great example on how to use Service Worker sync to make your app work offline by placing messages on IndexDB as queue and syncing when there's connectivity back.

The code is quite direct and can almost be copy and pasted to adapt to your app. I'm adding this functionality for my micropub editor.

One caveat, the IDB library for accessing IndexDB [doesn't work well in Firefox](https://github.com/jakearchibald/idb/issues/42) and it is [because of Firefox](https://bugzilla.mozilla.org/show_bug.cgi?id=1383029) :( 