简体   繁体   English

Node.js请求模块全局事件

[英]Node.js request module global events

Is it possible using request to capture the events that are fired at the start and end of a request? 是否可以使用请求捕获在请求开始和结束时触发的事件? I would like to attach a global event handler to request so that I can count the number of requests in progress at any given time. 我想附加一个全局事件处理程序来请求,以便我可以在任何给定时间计算正在进行的请求数。

Rather than attaching .on('response') and .on('end') to every request call in my code, I'd like to centralize it in one place. 而不是将.on('response').on('end')到我的代码中的每个请求调用,我想将它集中在一个地方。

您可以使用您的wrapper.in节点6包装请求模块并调用请求,您可以使用代理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM