New filters on the Home Feed, take a look!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

7
Best practice for handling network offline conditions
Post Body

I maintain an application which is online-first (if that's even a phrase) in so far as it is relatively safe to assume that users will have online access. (It's a dating app, so lots of searching and online functionality.)

That being said, user devices go offline for lots of reasons - bad cell service, spotty Wi-Fi, airplane mode, general network flakiness, whatever. Most of my client-side errors, after squashing logic/code issues, stem from failed network requests or offline conditions.

What would you consider to be "best practice" for the client to handle these situations?

It seems to boil down to two main failure modes:

  • Device is offline and we know it, e.g. the app can subscribe to device info to be told it is offline, e.g. no network connection.
  • Device thinks it's online but network conditions result in unpredictable network failures. I know I should be handling this through promise rejections, etc., however what am I likely not doing that you are? E.g., locking out the UI until we can detect a better network environment, etc.?

Author
Account Strength
100%
Account Age
6 years
Verified Email
Yes
Verified Flair
No
Total Karma
5,125
Link Karma
1,621
Comment Karma
3,282
Profile updated: 5 days ago
Posts updated: 10 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago