Skip to content

client.setMaxSockets()

SaltwaterC edited this page Oct 4, 2011 · 4 revisions

client.setMaxSockets(numberOfSockets)

Helper for setting the maximum number of concurrent outgoing HTTPS connections. The library expects and integer value. Otherwise it defaults to 5 which is the internal value of node.js itself. 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.

Clone this wiki locally