Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check connection before test speed #1

Open
jaydson opened this issue Oct 19, 2016 · 2 comments
Open

Check connection before test speed #1

jaydson opened this issue Oct 19, 2016 · 2 comments

Comments

@jaydson
Copy link
Member

jaydson commented Oct 19, 2016

As suggested by @felipenmoura, it'd be useful to first check if there's connection before properly check the speed.

@jaydson
Copy link
Member Author

jaydson commented Oct 20, 2016

Just did a brief research trying to find what is the best approach for that, and it seems to be something like @sindresorhus is-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.

@felipenmoura
Copy link
Member

Interesting, indeed!
It seems to be an interesting approach.

Perhaps we could verify if the connection is stablished in half the interval we check the speed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants