2.1.6 • Published 4 years ago

moti-make-heartbeat v2.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

moti-make-heartbeat

The Variable Speed Sign application accepts heartbeat JSON payloads from trusted sources. This library produces fake data that can be used for testing.

Installing

npm i moti-make-heartbeat

Usage

There are three parameters to adjust. 1. numSigns - The number of signs 1. numCorridors - The number of corridors 1. historySize - The number of history records

The numSigns are split evenly amoung all corridors specified within numCorridors. The historySize refers to the number of sign changes in the history array for each sign. Speeds within the history are random between 50 - 100. The timestamps within the history step back ten minutes per record from the current time.

const request = require('request');
const makeHeartbeat = require('moti-make-heartbeat');

const options = {
  numSigns: 60,
  numCorridors: 3,
  historySize: 10
}

const heartbeat = makeHeartbeat.create.heartbeat(options);

request({
  url: "https://url.to.server",
  method: "POST",
  json: heartbeat
});

Testing

Create a test heartbeat object and print to the console

cd moti-make-heartbeat
npm test

You can adjust the parameters in the test/run.ls file.

2.1.6

4 years ago

2.1.5

4 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 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

1.0.0

5 years ago