forever-agent is a Node.js module that provides an HTTP Agent designed to maintain persistent socket connections between `http.request` calls, enabling HTTP keep-alive behavior. It was originally an internal component of the widely popular, but now deprecated, `request` HTTP client library. The current stable version, 0.6.1, was last published over 11 years ago in April 2015. With the official deprecation of its progenitor `request` library in 2020, forever-agent itself is considered unmaintained and has seen no significant updates for over a decade. Its key differentiator was offering direct control over connection pooling for keep-alive outside of the `request` library, at a time when native Node.js HTTP client features were less developed regarding persistent connections.
npm install forever-agentVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate `ForeverAgent` and use it with Node.js's native `http.request` to achieve persistent (keep-alive) connections across multiple requests to the same host.
Migrate to `undici` (Node.js 18+) or use the native `http.Agent`/`https.Agent` with `keepAlive: true` and `maxSockets` options for connection pooling. For example:
`const agent = new http.Agent({ keepAlive: true, maxSockets: 10 });`Update to an actively maintained HTTP client library or utilize Node.js's native `Agent` options for `keepAlive` functionality. Thoroughly test existing applications if upgrading Node.js versions while still relying on `forever-agent`.
Immediately replace `forever-agent` with a modern, actively maintained HTTP client library or the native `http.Agent`/`https.Agent` which receive regular security patches as part of Node.js core.
Use CommonJS `require` syntax instead: `const ForeverAgent = require('forever-agent');`Ensure you are instantiating it as a class: `const agent = new ForeverAgent();`
This is a warning, not an error. The fix is to acknowledge the deprecation and plan for migration to a modern, supported alternative like `undici` or the native Node.js `http.Agent` with `keepAlive`.
No dependency data recorded yet.