heroku-pinger
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "heroku-pinger", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A simple ping scheduler to prevent free Heroku apps from going to sleep when they shouldn't.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# heroku-pinger | ||
A simple ping scheduler to prevent free Heroku apps from going to sleep when they shouldn't. | ||
@@ -6,19 +7,44 @@ | ||
Heroku-pinger DOES NOT simply ping your Heroku app every 29 minutes, instead, you call a method, `.schedulePing()`, which will set a timer to ping your app in 29 minutes. This way, your app will still be able to fall asleep (thus conserving your free hours) when there is no activity on the app. | ||
### Wait, isn't this just a normal pinger?! I can just use setInterval... | ||
### Usage | ||
Heroku-pinger DOES NOT simply ping your Heroku app every 29 minutes, instead, you call a method, `.schedulePing()`, which will set a timer to ping your app (default is 29 minutes). This way, your app will still be able to fall asleep (thus conserving your free hours) when there is no activity. | ||
## Usage | ||
#### Installation | ||
`npm install --save heroku-pinger` | ||
#### Parameters, Method(s), and Option(s) | ||
```js | ||
herokuPinger(url, options) | ||
const pinger = require('heroku-pinger')(url, options); | ||
``` | ||
`pinger.schedulePing()` - Schedule a ping | ||
`options.cooldown` - Specify the ping delay after `.schedulePing()` is called, in milliseconds | ||
`pinger.schedulePing()` - Schedule a ping. | ||
### Disclaimer | ||
Neither the creator nor this project is associated with Heroku. | ||
`options.cooldown` - Specify the ping delay after `.schedulePing()` is called, in milliseconds. Defaults to 29 minutes. | ||
If you have any criticisms, questions, suggtions, or simply want to talk, you can email me at pscott@zeptohost.com | ||
#### Terse example | ||
```js | ||
// Other dependecies, eg express, etc. | ||
const SITE_URL = "https://yourapp.herokuapp.com"; | ||
const herokuPinger = require('heroku-pinger'); | ||
const pinger = herokuPinger(SITE_URL); | ||
const io = require('socket.io')(server); | ||
// App routing, etc. | ||
io.on('connection', (socket) => { | ||
socket.on('chat message', function(data) { | ||
socket.broadcast.emit('chat message', data); | ||
pinger.schedulePing(); | ||
}); | ||
}); | ||
``` | ||
## Disclaimer | ||
Neither this project nor the project's creator are associated with Heroku. | ||
If you have any criticisms, questions, suggestions, or simply want to talk, you can email me at pscott@zeptohost.com |
2883
50