1.0.8 ā€¢ Published 7 years ago

drumstick v1.0.8

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

drumstick šŸŽ¼npm version

drumstick let's you send a heartbeat to a custom endpoint in a fixed interval.

Features

  • šŸ” heartbeat to a server in a fixed interval
  • šŸ–Œ at run-time customizable payload

Installation

npm install --save drumstick

Usage

šŸŽ¼ Import drumstick and call start().

import drumstick from 'drumstick'

drumstick.start({
  method: 'POST',
  endpoint: 'http://localhost',
  payload: {},
  frequency: 1000,
  debug: false,
})

Configuration

  • method: the type of HTTP request to send the server POST | GET | HEAD | PUT | DELETE
  • endpoint: the endpoint drumstick should send the payload
  • payload: the payload that should be sent to the endpoint (Will be stringified before sending)
  • frequency: the frequency for the heartbeat in milliseconds
  • debug: outputs the body of a succeeded request

Functions

There are also other functions that you can call to change the behavior of drumstick at runtime.

changePayload(payload)

Change the payload at anytime to any json object. It'll be stringified before sending to the endpoint.

changeFrequency(frequency)

Change the frequency of heartbeat.

pause()

Pauses the heartbeat.

resume()

Resumes the heartbeat after it has been paused.

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.1

8 years ago