npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

meteor-ping

v1.0.3

Published

Ping a Meteor app to confirm it is online

Downloads

27

Readme

meteor-ping

Build Status

Ping a Meteor app. This "DDP ping" only succeeds if a Meteor-specific test (subscribing to a collection) passes.

Timing is done internally to adjust for Node.js startup time.

This code is used heavily and frequently for pinging many Meteor apps in production.

Synopsis

Command-line use

npm install -g meteor-ping
meteor-ping --host www.meteor.com --port 443

Upon failure, a message is printed to standard error and the program exits with an error code.

Upon success, the milliseconds elapsed for the ping is printed to standard output.

API

npm install --save meteor-ping

The only public function is ping(), which takes one argument, a standard Node.js-style callback. The second argument to the callback is an object with one key: elapsedTimeInMs. Example usage:

'use strict';

var MeteorPing = require('meteor-ping');

// all args are optional, here are the defaults
var localApp = new MeteorPing({
  host: 'localhost',
  port: 3000,
  ssl: false,
  timeout: 10 * 1000, // 10 seconds
});

localApp.ping(function(error, result) {
  if (error) {
    console.error(error);
    process.exit(1);
  } else {
    console.log('done. Milliseconds elapsed: ' + result.elapsedTimeInMs);
  }
});

MeteorPing constructor arguments

All arguments are optional.

  1. host - domain name of Meteor server to ping. Must be a valid IP address or hostname.
    • Default localhost.
  2. port - port of Meteor server to ping. Must be a valid port number.
    • Default 3000.
  3. ssl - whether to use SSL for the connection. Boolean. Automatically true if port is 443 (no idea why).
    • Default false.
  4. connectTimeout - milliseconds before timing out the DDP connect() call. Must be a number greater than or equal to 1.
    • Default 5000.
  5. subscribeTimeout - milliseconds before timing out the DDP subscribe() call. Must be a number greater than or equal to 1.
    • Default 5000.
  6. collection - collection to use for subscribe() call. Must be a string. Consider using a database-backed collection if you have one--this provides a full round-trip ping.
    • Default meteor.loginServiceConfiguration.

Description

Meteor apps deliver static content and layout. A websocket or long-polling connection is used to deliver data. An app may return a HTTP 200 OK even if data cannot be retrieved. It is helpful to have a smarter check to ensure the static content and data are available.

The pinged app must use the Accounts system or must override the collection constructor argument.

Compatibility

This package has been tested with Node.js version 4.6.1.

Copyright, License

Copyright (C) 2016 Adam Monsen

MIT license.