react-detect-offline
react-detect-offline copied to clipboard
Polling improvements: switch to faster host, accept error responses
Faster host
We use ipv4.icanhazip.com
currently because that's the standard for other JS polling libraries. But we can probably get much faster. Here are some quick tests:
--- ipv4.icanhazip.com ping statistics ---
round-trip min/avg/max/stddev = 154.028/159.056/188.548/11.154 ms
159 ms average
--- google.com ping statistics ---
round-trip min/avg/max/stddev = 23.071/24.103/26.079/0.830 ms
24 ms average
--- twitter.com ping statistics ---
round-trip min/avg/max/stddev = 51.824/52.745/53.685/0.731 ms
52 ms average
--- akamai.com ping statistics ---
round-trip min/avg/max/stddev = 39.591/40.428/41.625/0.620 ms
40 ms average
Can anyone think of a host to try that might beat google?
Accept error responses
#20 introduced a subtle change that we should look into more: looking at response status. We should accept (i.e. count as "online") any response, as long as it comes from the server. a 404 and a 500 both mean that we contacted the server, and are just as good as a 200.
Hey, it seems the library has an issue in windows. It shows this url http://ipv4.icanhazip.com/ can't be accessed.
@Francomgarcia see https://github.com/chrisbolin/react-detect-offline/issues/41
You’re in luck! Check out the polling.url prop
On Fri, Jun 21, 2019 at 5:08 AM Krzysztof Węgliński < [email protected]> wrote:
nice, I'd extend it with customisable url so if I have i.e. api/status endpoint then I could use it
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chrisbolin/react-detect-offline/issues/37?email_source=notifications&email_token=AAVQ7IADJGWGGIJNSJMJX3DP3SZD5A5CNFSM4HCQRXIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYIFSJI#issuecomment-504387877, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVQ7IBWVSTSREHKS76O6SDP3SZD5ANCNFSM4HCQRXIA .