How to capture network calls in node js?

368 views
Skip to first unread message

Prabhu Venkat

unread,
Oct 23, 2015, 8:39:58 AM10/23/15
to nodejs

In firebug addon for firefox there is a tab named 'Net' which captures all the network calls made when we hit an URL from the browser

I can request the URL from code but i am finding ways to capture the network calls being made, get the request parameters passed in the network call

Can this be done using NodeJS?

Aria Stewart

unread,
Oct 23, 2015, 8:52:15 AM10/23/15
to nod...@googlegroups.com
On Oct 23, 2015, at 3:05 AM, Prabhu Venkat <prabh...@gmail.com> wrote:

In firebug addon for firefox there is a tab named 'Net' which captures all the network calls made when we hit an URL from the browser

I can request the URL from code but i am finding ways to capture the network calls being made, get the request parameters passed in the network call

Can this be done using NodeJS?=




Not entirely easily! That kind of tracing infrastructure is complicated and sometimes performance-altering, and it hasn't been built.

What I do for unencrypted connections is use tcpdump, ngrep or wireshark to snoop on the traffic and interpret it from a network capture.

With encrypted connections, things get much more difficult and I don't have great strategies short of 'attach debugger to the https library, watch what it does'.

Aria

Matt

unread,
Oct 23, 2015, 10:57:20 PM10/23/15
to nod...@googlegroups.com
You can run your code with:

NODE_DEBUG=http node app.js

And it will give you some level of debugging to stderr. It may or may not be enough - it mostly sends error conditions out.

There are a few other NODE_DEBUG values you can use. There's an article on using it here: http://www.juliengilli.com/2013/05/26/Using-Node.js-NODE_DEBUG-for-fun-and-profit/

Matt.

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/c1b64a2f-cb4c-454e-91fd-72cbacbf9f45%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages