question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better offline check instead of `navigator.onLine` (as it is fairly unreliable)

See original GitHub issue

If you test offline mode by turning off your wifi or unplug your computer cable, it’s probably be fine, the plugin tell you that “There is no internet connection”.

However, I think that’s not reflecting the real situation users might get. Sometimes it’s because of provider issue, or just simply unplug the cable from the modem (wifi is still connected), Uppy failed to notify me that there is no internet. (mainly because navigator.onLine event is not firing), and the upload is stalled after that, the pending PATCH request never get completed (yes, I’m using Tus plugin)

There must be a better way, for example, if we’re not receiving upload-progress event for certain amount of time (eg. 30 seconds), we could inform to the user: Experiencing network interuption… and then retry the upload, rather than let it hanging forever.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Acconutcommented, Jun 7, 2021
3\. What happens if you add Tus to Uppy, will `retryOptions` ever interfere with `timeout`?

Potentially yes, although I think it’s unlikely. If a retry kicks in (e.g. because a PATCH request failed), a HEAD request must be sent first (with potential retries as well) before uploading resumes. During this time no progress event will be emitted.

Also, a few cents from my experience with progress events: Some implementations emit a progress event every X bytes (e.g. every 64KiB). So, if you have a 1KiB/s connection, it is normal to only have one progress event per minute 😃

0reactions
stale[bot]commented, Jun 10, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is your app online? Here's how to reliably know in just 10 lines ...
If not, you'll need a reliable way to detect if your app is offline in order to offer the proper experience. Here's how...
Read more >
654579 - navigator.onLine status for Offline Applications ...
onLine status for Offline Applications (navigator. onLine always returns true for desktop Firefox unless "work offline" is manually selected)
Read more >
How to detect online/offline event cross-browser?
Returns true if the user agent might be online. The events online and offline are fired when the value of this attribute changes....
Read more >
Broken Offline Support - Remy Sharp
Actually, no, but it's misleading to developers to see these events in the HTML5 spec. At the very minimum we need navigator.onLine to...
Read more >
useOnlineStatus — A React hook to know when your app is ...
navigator.onLine in browsers tells you if your device has a connection to any network and not specifically to the internet.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found