🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

ping-tcp-js

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ping-tcp-js

Welcome to đź‘‹

latest
Source
npmnpm
Version
2.0.4
Version published
Weekly downloads
76
-60.62%
Maintainers
1
Weekly downloads
 
Created
Source

Welcome to đź‘‹

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
);
  • 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));
  • 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 });
  • 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));
  • 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

Keywords

ping

FAQs

Package last updated on 18 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts