【发布时间】:2020-04-29 03:07:46
【问题描述】:
我正在尝试在请求上设置maxSockets,并在创建客户端时将其发送到node-soap。没有这个,交易运作良好。我尝试通过 httpAgent 添加它,但是一旦添加了 maxSockets 属性,我得到了 socket hang up 错误。所以,我现在的方法是尝试使用库中可用的httpClient 进行配置,但是,我无法做到。这是我的代码:
//OPTION 1
const httpsAgent = new https.Agent({ keepAlive: true });
const httpsClient: AxiosInstance = axios.create();
httpsClient.request({
url: url,
httpsAgent: httpsAgent,
timeout: 15000,
});
//OPTION 2
const httpsAgent = new https.Agent({ keepAlive: true });
const httpsClient: AxiosInstance = axios.create();
httpsClient.defaults.httpsAgent = HttpsAgent;
这是库文档中关于 httpClient 的说明:
httpClient: to provide your own http client that implements request(url, data, callback, exheaders, exoptions).
【问题讨论】:
标签: node.js http soap httpclient node-soap