Buzzer
Pings given URL(s) for a given duration and interval.
- Heroku: This is particularly useful for cheap hosting on Heroku, just open up a free-tier dyno, have another host run the buzzer against the dyno's ip, and you're set to have that dyno awake for the maximum amount of time allowed per day (18 hours)
Installation
npm install --save buzzer
Configuration
- endpoint: Endpoint to be pinged by buzzer instance
- interval: Interval (in milliseconds) between pings
- Defaults to 20 minutes (1000 * 60 * 20 ms)
- startHour: The hour the buzzing window starts (out of 23)
- Defaults to 7
- startMinute: The minute the buzzing window starts (out of 59)
- Defaults to 30
- startSecond: The second the buzzing window starts (out of 59)
- Defaults to 0
- endHour: The hour the buzzing window ends (out of 23)
- Defaults to 1
- endMinute: The minute the buzzing window ends (out of 59)
- Defaults to 0
- endSecond: The second the buzzing window ends (out of 59)
- Defaults to 0
- callback: Callback to be triggered on every ping
- Parameters:
(error, response)
- Parameters:
Example Config
;const buzzerConfig = endpoint: 'http://my-free-dyno.herokuapp.com' interval: 1000 * 60 * 25 startHour: 6 startMinute: 0 endHour: 11 endMinute: 30 callback: err res if err console; else console; ;const buzzer = buzzerConfig;buzzer;
Basic Example
On a separate host, add a buzzer (or multiple) to maintain your free dyno(s). This example uses the default values to open a buzzing window from 7:30AM to 1AM
;;const app = ; const buzzer = endpoint: 'http://my-free-dyno.herokuapp.com';buzzer; app;app;app;
Contribute
There is literally nothing special you need to do to get this up and running and contribute. Clone it down, install the dependencies, and go.