Reputation: 11
In order to avoid the time spent on the creation of the sockets. My node server need some "long connection"(TCP Socket) to keep communicating with the server written in C which runs in the background, and all the 'http request' could share the TCP sockets in the pool. I wonder if there is a kind of socket pool implementation in nodejs? (something like the database connection pool)
Any help will be appreciated !
Upvotes: 1
Views: 4721
Reputation: 481
generic pool is a good one. https://github.com/coopernurse/node-pool But as for http, there's built-in pooling mechanism .
Upvotes: 4
Reputation: 15003
Take a look at the official documentation for http.Agent; that's what (behind the scenes for most node developers) handles allocation of available sockets.
Upvotes: 0