[英]What's the best way to monitor third-party traffic with Node.js?
I'm trying to identify all outbound http requests for resources on third-party sites using Node.js.我正在尝试使用 Node.js 识别对第三方站点上的资源的所有出站 http 请求。 I've started using Phantomjs (and phantomjs-node) which has network monitoring features, but I'm finding it unreliable for many sites.
我已经开始使用具有网络监控功能的 Phantomjs(和 phantomjs-node),但我发现它对许多站点都不可靠。
I've seen tools like Charles and Fiddler, but I'm trying to incorporate the third-party http requests into my own Node.js app.我见过像 Charles 和 Fiddler 这样的工具,但我正在尝试将第三方 http 请求合并到我自己的 Node.js 应用程序中。
Is there any other way to approach this without using a headless browser?有没有其他方法可以在不使用无头浏览器的情况下解决这个问题?
I am not really a fan of using phantomjs from Node.我并不是很喜欢使用 Node.js 中的 phantomjs。 Essentially PhantomJS has its own Event Loop and Node JS has its own and most of the npm modules(including phantomjs-node) available online will use some sort of messaging(Websocket etc.) to communicate between the two.
本质上,PhantomJS 有自己的事件循环,Node JS 有自己的,大多数在线提供的 npm 模块(包括 phantomjs-node)将使用某种消息传递(Websocket 等)在两者之间进行通信。
Now back to your original problem.现在回到你原来的问题。
You have a few options:您有几个选择:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.