Skip to content

client.setMaxSockets()

SaltwaterC edited this page Jan 20, 2012 · 4 revisions

About

Helper for setting the maximum number of concurrent outgoing HTTPS connections.

Reference

client.setMaxSockets(numberOfSockets)
  • 'numberOfSockets' - unsigned integer value for setting the max sockets. Invalid values makes it to default to 5 (node.js default).

This works by setting the undocumented property: https.Agent.defaultMaxSockets. This change affects all the HTTP / HTTPS clients built on top of the core http.js / https.js libraries. In other words, if you call this helper for an aws2js client, it has side effects for other libraries using the core HTTP support.

Since the core modules themselves handle the concurrency, messing with the HTTP Agent per client instance brings little benefit, but it complicates the actual code that manages this feature. Therefore, using https.Agent.defaultMaxSockets is the preferred for achieving this goal of increasing the max concurrency.

This method is chainable (aka it returns the client object).

Clone this wiki locally