activa
v1.0.0
Published
Keep your website active by sending periodic requests
Maintainers
Readme
activa
Keep your website alive by sending periodic HTTP requests.
Ideal for preventing sleeping or idling on free hosting platforms.
Installation
npm install activaUsage
Import and start pinging
import { websiteActiva } from "activa";
// Start pinging every 15 minutes (default)
const intervalId = websiteActiva("https://example.com");
// Custom interval (in minutes)
const customIntervalId = websiteActiva("https://example.com", 10);Stop the ping
// Stop after 1 hour
setTimeout(() => {
clearInterval(customIntervalId);
console.log("Stopped keep-alive.");
}, 60 * 60 * 1000);Features
- Zero dependencies
- Supports both
httpandhttpsURLs - Immediate first ping on start
- Returns interval ID so you can stop pings anytime
Notes
- The
intervalparameter is in minutes. - If your hosting platform expects frequent pings, adjust the interval accordingly.
- Always use
clearInterval(intervalId)to stop pinging when no longer needed.
License
MIT
