docs: UPDATING_DURING_DISRUPTION.md minor edits (ref. #30)

merge-requests/12/merge
Michał 'rysiek' Woźniak 2022-02-08 22:22:23 +00:00
rodzic 27f3cbf908
commit 7a8105573a
1 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -1,10 +1,14 @@
# Updating the configuration during disruption
If a website is experiencing an outage, but LibResilient is deployed on it and is working correctly for the visitors whose browsers were able to install and activate it before the disruption started, it is possible to update LibResilient configuration using any alternative transport plugins available.
It is not, however, possible to load plugins that have not been previously loaded based on the previous `config.json`, as this would require a call to `importScripts()` and thus: a direct HTTPS request to the original domain.
## ServiceWorker API and `importScripts()`
The [Service Worker API](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers) allows for updating the service worker script itself and any imported scripts (via [`importScripts()`](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts)) only via a direct HTTPS request to the original domain.
For this reason, LibResilient expects configuration in a `config.json` file, not in a script loaded via `importScripts()`. This allows updating the configuration during disruptions. The `importScripts()` limitation still affects plugin scripts, however.
If a website is experiencing an outage, but LibResilient is deployed on it and is working correctly for the visitors whose browsers were able to install and activate it before the disruption started, it is possible to update LibResilient configuration using any alternative transport plugins available. It is not, however, possible to load plugins that have not been loaded based on the previous `config.json`, as this would require using `importScripts()` and thus: a direct HTTPS request to the original domain.
LibResilient expects configuration in a `config.json` file, not in a script, so that it can be retrieved and used without a call to `importScripts()`. This allows updating the configuration during disruptions. The `importScripts()` limitation still affects plugin scripts, however: it is not possible to load new plugin scripts while the original website is experiencing disruption or outage.
## LibResilient's Service Worker lifecycle