HTTP keep-alive in node.js

后端 未结 3 535
南旧
南旧 2020-12-06 06:19

I am trying to set-up a HTTP client to keep the underlying connection open (keep-alive) in node.js, but it seems that the behaviour does not correspond to the docs (http://n

3条回答
  •  臣服心动
    2020-12-06 07:16

    I guess it should work on node 0.12+. You may also want to use a different agent for this purpose. For example keep-alive-agent can do what you want:

    var KeepAliveAgent = require('keep-alive-agent'),
        agent = new KeepAliveAgent();
    

提交回复
热议问题