New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tcp-ping-node

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tcp-ping-node

TCP ping utility for node.js with promise support

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16
decreased by-40.74%
Maintainers
1
Weekly downloads
 
Created
Source

tcp-ping-node

TCP ping utility for node.js with promise support. You can test if chosen address accepts connections at desired port and find out your latency.

One of the critical topic of Microservice architecture is Observability. The operator need to find a way to detect the microservice's readiness, liveness and health. Health Check API (/health) is the most common practise to provide the ability for platform to observe the microservice. Hence, dependency of microservice is the main figure about its health.

Installation

npm install tcp-ping-node

How to use it

You can just simply call the ping API, which is asynchronous. After the ping complete, it will return the result for your follow-up action.

 const options = {host: 'www.bing.com', port: '80', timeout: 10000}
 const result = await ping(options);

You will get the result with JSON format:

{
    "host": "www.bing.com", 
    "port": 80,
    "success": true,
    "time": "49.388"
}

API

ping(options)

ping(options) is an asynchronous API. it accepts the options with below format:

  • host: address to ping. Default is localhost
  • port: port of above address to ping. Default is 80. both number and string type are accepted.
  • timeout: ping timeout setting in ms. Default is 5000 ms.

It returns the result as below:

  • host: host to ping.
  • port: port of host to ping.
  • success: indicate that whether the ping is success or not.
  • time: the elapsed time of ping action in ms.

Keywords

FAQs

Package last updated on 04 Nov 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc