I recommend using Mikeal's request module:
https://github.com/mikeal/request — Sent from Mailbox for iPhone On Tue, Apr 9, 2013 at 2:40 AM, Wes Gamble <[email protected]> wrote: > OS X 10.8.3 > Node 0.10.0 > I'm using the 'http' module to make requests of the Facebook graph API. > Here are the options that I pass to 'http.get': > var options = {host: 'graph.facebook.com', > port: 80, > path: '/' + fb_id + '/picture'}; //when fb_id is a > valid Facebook user identifier > My code looks like this: > http.get(options, > function(res) { > ...some stuff... > DONE(RESULT); //DONE is a callback function > }).on('error', function(e) { > ...some error handling... > }); > What I observeis that I can only do as many requests as the value of > http.globalAgent.maxSockets. Once I reach that many requests, the next > call to http.get never (apparently) connects. I've verified that I'm not > getting errors on the requests. > It's as though the sockets are not being closedafter the response comes in. > Is there something I need to do as part of the response handler to > ensure that the socket is closed? > Are these sockets not closing because of the default keepalive behavior? > How should I proceed to debug this? > Thanks, > Wes > -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > 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 post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > --- > 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 [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: 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 post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
