Fix: Android Support
complete
RN Guerrero
The addition of offline support to Comms broke the ability to access Comms on Android devices. The problem is that Comms uses the SharedWorker API which Google Chrome for Android doesn’t support.
Another approach, which I prefer, is to replace use of the SharedWorker API with the ServiceWorker API instead. All major browsers support the ServiceWorker API and, like SharedWorkers, ServiceWorkers are accessible via multiple tabs. I’ve also confirmed that they support transferring objects between tabs using
postMessage()
(i.e. we can use a service worker to transfer MessagePorts). The downside of this approach is that it will require rewriting how we share the sqlite service between tabs. ServiceWorkers can be terminated at any time by the browser, so you cannot reliably store state in-memory within a ServiceWorker. Additionally, traditionally service workers are installed lazily by the browser and aren’t necessarily activated immediately. If someone navigates to Comms for the first time, there will be no service worker. In the background, the service worker installation will begin but it might take several seconds for this to happen. Comms will need the service worker to be available to properly initialize the persisted sqlite service. This means we’ll need to show a loading screen until the service worker has registered and activated. Not a big deal, but it’s more work that needs to be done.RN Guerrero
complete