You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just did a brief research trying to find what is the best approach for that, and it seems to be something like @sindresorhusis-online.
is-online is cool and reliable AFAICS.
Let's look how it works:
In node, we first contact one of the thirteen root servers and ask them to direct us to the servers which host the zone (Which they are themselves). If the server answers, we return an online status.
If no satisfying answer is given within one second, we return an offline status. In the rare case where an firewall intercepts the packet and answers it on its behalf, a second check is run which tries to connect to a series of popular web sites on port 80. If one of these connects, we return online, otherwise offline status.
@felipenmoura previously suggested an always-connected-socket approach, but it's hard and not reliable, as we'd need to have our own infrastructure.
For example, what if our server face some network issue? It will result in a false positive for the clients.
As suggested by @felipenmoura, it'd be useful to first check if there's connection before properly check the speed.
The text was updated successfully, but these errors were encountered: