feross / feross/connectivity

Optional url param

Open
#3 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
61
Forks
6
PR merge metrics
No merged PRs in 30d

Description

I think it would be a good feature to allow users have an optional object parameter to check if they can connect to a server. This would be useful for websites that might sometimes be down or to check if a server on localhost is running.

```js
var connectivity = require('connectivity')

connectivity({host: 'localhost', port: 8000}, (online) => {
console.log(online ? 'connected to the internet!' : 'sorry, not connected!')
})
```

The object parameter would be optional, if there is no second parameter it would be assumed that the first parameter is the callback.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.