drumstick

1.0.8 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i drumstick

Weekly Downloads

1

Version

1.0.8

License

ISC

Last publish

Collaborators

  • brene