2.0.4 • Published 3 months ago

ping-tcp-js v2.0.4

Weekly downloads
24
License
MIT
Repository
github
Last release
3 months ago

install

npm install ping-tcp-js

ping

  • param
const client = require("ping-tcp-js");
// or
import client from "ping-tcp-js";

const host = "google.com";
const port = 80;

await client.ping(
  { host, port },
  { timeout: 5000 } // optional
);
  1. host
const client = require("ping-tcp-js");
// or
import client from "ping-tcp-js";

const host = "google.com";
const port = 80;

client
  .ping({ host, port })
  .then(() => console.log("connect ping"))
  .catch((e) => console.error("not disconnet", e));
  1. url
const client = require("ping-tcp-js");
// or
import client from "ping-tcp-js";

const host = "https://google.com";

client
  .ping({ host })
  .then(() => console.log("connect ping"))
  .catch((e) => console.error("not disconnet", e));

pingBackOff

time : Reconnect time count : Number of times

  • param
const client = require("ping-tcp-js");
// or
import client from "ping-tcp-js";

const host = "google.com";
const port = 80;

// or
client.pingBackOff({ host, port }, { time: 5000, count: 10, timeout: 5000 });
  1. host
const host = "google.com";
const port = 80;

client
  .pingBackOff({ host, port }, { time: 5000, count: 10, timeout: 5000 })
  .then(() => console.log("connect pingBackOff"))
  .catch((e) => console.error("not disconnet", e));
  1. url
const host = "https://google.com";
client
  .pingBackOff({ host: host }, { time: 5000, count: 10, timeout: 5000 })
  .then(() => console.log("connect pingBackOff"))
  .catch((e) => console.error("not disconnet", e));

Test

npm run test
2.0.4

3 months ago

2.0.3

3 months ago

2.0.0-alpha-2

3 months ago

2.0.2

3 months ago

2.0.0-alpha-3

3 months ago

2.0.1-alpha-1

3 months ago

2.0.1

3 months ago

2.0.0

3 months ago

1.5.0

2 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

0.0.1

5 years ago

1.0.0

5 years ago