knockat v4.0.101
knockat
knockat waits until a host is reachable.
Status
| Category | Status |
|---|---|
| Version | |
| Dependencies | |
| Dev dependencies | |
| Build | |
| License |
Installation
$ npm install knockatQuick start
First you need to add a reference to knockat in your application:
const { knock } = require('knockat');If you use TypeScript, use the following code instead:
import { knock } from 'knockat';Then, call its at function and provide the host as well as the port you want to knock at:
await knock.at('localhost', 3000);Once the host is reachable, the at function returns. If the host is not reachable permanently, it throws an exception.
Changing the number of retries
If you want to use a different number of retries you basically have two options. You can either set a new default value or set a value for a specific request.
To set a new default value set the retries property:
knock.retries = 100;If you only want to set this value for a specific request, provide an options object with a retries property:
await knock.at('localhost', 3000, { retries: 100 });Understanding the algorithm
When you run knockat, it uses the following algorithm to detect whether the given host is reachable:
- If the host is reachable, the module returns immediately.
- If the host is not reachable, knockat retries to reach the host every two seconds.
- If the host is not reachable within 60 retries, knockat fails.
Running quality assurance
To run quality assurance for this module use roboter:
$ npx roboter3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
10 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago