This project is read-only.

Recovering from offline status

Mar 13, 2014 at 5:45 PM
Hi there,

I need to understand how the app handles the offline status.

I started from the template as distributed and changed the resource URLs to use a Wordpress blog page instead the WAT documentation page, adding a page and the category links as nested menu options to the app bar. That works fine.

Now, I disable my WiFi connection, no other Internet connection remains.

I start the app fresh and I expect the app to show me the offline error page - expectation met. So far so good.

While the app is still running on that page, I re-enable WiFi and make sure in another app that connectivity is restored. I switch back to the WAT app, opening the app bar and hitting any of the links in there (Home etc.). Expectation is that the app will open the corresponding URL. Instead, the app remains on the offline error page after refreshing that error page.

My assumption is that this is a bug in the template, caused by the offline state still being persistent in the app's state. After loading the offline error page, the WAT template should make sure that any following app activity re-tests the online status to recover.

Any suggestions?

thanks,

Tobias Weisserth
Apr 15, 2014 at 5:35 PM
Hi Tobias,
Your assumptions are correct. The offline event should be triggered by one of two events:
   1. offline even fires
   2. a 404 page
The app should automatically come on line when one of two things happen:
   1. online event fires
   2. app navigates to a page and receives content instead of a 404
It seems like what you are seeing is the app go into offline mode from hitting a 404, but not come back online from either of the two events. Is this correct?
Apr 16, 2014 at 5:51 AM
Hi there,

After playing a little with flight mode on/off while a WAT based app is running in the foreground, I'm pretty sure the online event (after disabling flight mode) is not registered correctly as the app keeps showing the offline error page.

When enabling flight mode, the app detects the offline event, immediately showing the offline error page (even for a preloaded content page without navigation to content that requires a request).

When disabling flight mode, any navigation will reload the offline error page. I checked, there is no actual HTTP request going out from the app, so it is most likely an issue with the online event not being registered, and the application state being locked in offline mode. I will try to dedicate some time myself to see if I can find the code part in the template code where that happens.

On that topic, I am wondering if the WAT should respect HTTP caching response headers on pages and their referenced objects to determine what to show from local cache in offline mode before requesting content from the web server based on cached object TTL. Just an idea. As so much work is already expected to come in at the web application running on the server, it would be nice if you could define the offline viewing behavior through standard HTTP response headers on the server (or through a CDN) as well.

Thanks!

Tobias W.