Application updates

The GWA API queries the status of the application and can update it automatically even when not active.

In a GWA application, when the application ends, an "Application Ended" page is displayed. By default, a Reload page button is included on the application ended page, allowing users to easily restart the application.

If the application has been updated server side in the meantime, clicking the Reload page button will start the updated version of the application.

Automatic application updates

As the GWA uses JavaScript service workers, the application can even be updated when the program is not active; the browser automatically checks the server side for a new version and downloads the new version if there is one.

By default the application is also updated automatically when it is reloaded. This can happen when the user clicks the Reload page button on the application ended page, by using the browser reload menu action (F5 usually), or by reopening the browser with the same application URL.

To keep track of application updates, the gwabuildtool has an --app-version switch to set the application version. This version can be queried by using methods in the gwa.app package module.

User-driven update

The gwa.app package module has a function to query the up-to-date status of the application and perform a user-driven update immediately if a version difference is detected.

If a network connection is not available, the current installed version in the browser is used. Internally, the GWA tries first to contact the server for an update, if this fails, after 500ms the cached application version is used.

It is recommended that you code to check for updates after your application starts by calling the gwa.app.getServerVersionAndBuild() method.

For an example performing a user-driven update, explore the GWA "update" demo in your GWA installation directory. If installed in FGLDIR, you will find the demo in $FGLDIR/demo/gwa/update or if installed in a separate directory, you will find it in gwa-install-dir/demo/gwa/update.