{"_id":"keep-alive-agent","_rev":"119604","name":"keep-alive-agent","description":"a keep-alive agent for http and https","dist-tags":{"latest":"0.0.1"},"maintainers":[{"name":"ceejbot","email":"ceejceej@gmail.com"}],"time":{"modified":"2021-06-03T10:55:24.000Z","created":"2012-12-05T19:47:02.095Z","0.0.1":"2012-12-05T19:47:02.095Z"},"users":{"vchouhan":true,"honzajde":true,"leelee.echo":true,"syzer":true},"repository":{"type":"git","url":"git://github.com/ceejbot/keep-alive-agent.git"},"versions":{"0.0.1":{"name":"keep-alive-agent","version":"0.0.1","description":"a keep-alive agent for http and https","contributors":[{"name":"C J Silverio","email":"ceejceej@gmail.com","url":"http://ceejbot.tumblr.com/"},{"name":"Danny Coates","email":"dannycoates@gmail.com","url":"https://github.com/dannycoates/"}],"main":"index.js","scripts":{"test":"mocha -R spec test/*.js"},"repository":{"type":"git","url":"git://github.com/ceejbot/keep-alive-agent.git"},"keywords":["keep-alive","http","https","agent"],"license":"MIT","devDependencies":{"chai":"*","mocha":"*"},"readmeFilename":"README.md","_id":"keep-alive-agent@0.0.1","dist":{"shasum":"44847ca394ce8d6b521ae85816bd64509942b385","size":6427,"noattachment":false,"key":"/keep-alive-agent/-/keep-alive-agent-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/keep-alive-agent/download/keep-alive-agent-0.0.1.tgz"},"_npmVersion":"1.1.65","_npmUser":{"name":"ceejbot","email":"ceejceej@gmail.com"},"maintainers":[{"name":"ceejbot","email":"ceejceej@gmail.com"}],"directories":{},"publish_time":1354736822095,"_hasShrinkwrap":false,"_cnpm_publish_time":1354736822095}},"readme":"# keep-alive-agent\n\nkeep-alive-agent is an HTTP connection pool agent for node.js that re-uses sockets. It is simpler than some agents that also solve this problem because it does not attempt to replace the Agent provided by node. If you want to re-use connections, use this agent. If you want the default node behavior, use the default global agent.\n\n## Usage\n\n__new KeepAliveAgent(*options-hash*)__\n\nCreate an instance of the agent, passing the options hash through to the node Agent constructor. These options are in turn passed along to `createConnection()`. The KeepAliveAgent constructor does not use the options itself. The option you are most likely to change is `maxSockets`, which defaults to 5.\n\nTo use the agent instance, set it in the `agent` field of the options passed to `http.request()` or `http.get()`. See the [http.request() documentation](http://nodejs.org/api/http.html#http_http_request_options_callback) for details.\n\n__new KeepAliveAgent.Secure(*options-hash*)__\n\nA keep-alive agent that creates tls sockets. Use it the same way you use the http agent.\n\n## Examples\n\n```javascript\nvar http = require('http'),\n    KeepAliveAgent = require('keep-alive-agent');\n\nvar getOptions = {\n    hostname: 'twitter.com',\n    port: 80,\n    path: '/dshaw',\n    agent: new KeepAliveAgent(),\n};\nhttp.get(getOptions, function(response)\n{\n\tresponse.pipe(process.stdout);\n});\n```\n\nTo re-use secure connections, use the Secure keep-alive agent:\n\n```javascript\nvar https = require('https'),\n    KeepAliveAgent = require('keep-alive-agent');\n\nvar getOptions = {\n    hostname: 'www.duckduckgo.com',\n    port: 443,\n    path: '/?q=unicorns',\n    agent: new KeepAliveAgent.Secure(),\n};\nhttps.get(getOptions, function(response)\n{\n\tresponse.pipe(process.stdout);\n});\n```\n\n## See Also\n\nFor other implementations, see [agentkeepalive](https://github.com/TBEDP/agentkeepalive) and the [request](https://github.com/mikeal/request) module's [ForeverAgent](https://github.com/mikeal/request/blob/master/forever.js).\n\n## Licence\n\nMIT.\n","_attachments":{},"readmeFilename":"README.md","license":"MIT"}