Socket
Socket
Sign inDemoInstall

server-ready

Package Overview
Dependencies
2
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    server-ready

Know when a server is ready to receive requests


Version published
Weekly downloads
2K
decreased by-10.67%
Maintainers
1
Install size
14.1 kB
Created
Weekly downloads
 

Readme

Source

server-ready Build Status npm version

Know when a server is ready to receive requests. Used in hotel.

Install

npm install server-ready --save

Example

var serverReady = require('server-ready')

// A server process is spawned here or somewhere else...

serverReady(3000, function (err) {
  if (err) return console.error('timeout, can\'t connect to port')
  console.log('port is open or has just opened')
})

How it works?

server-ready will try to connect every 250ms to the specified port until a connection has been made or timeout has been reached (20s by default).

API

serverReady.timeout

Default timeout.

serverReady(port, [timeout], cb)

Tries to connect to port.

License

MIT - Typicode

Keywords

FAQs

Last updated on 17 Sep 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc