Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep alive #47

Open
sm2017 opened this issue Jun 8, 2019 · 5 comments
Open

Keep alive #47

sm2017 opened this issue Jun 8, 2019 · 5 comments

Comments

@sm2017
Copy link

sm2017 commented Jun 8, 2019

How can I keep alive connection?
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive

I asked here before , sindresorhus/got#815
But I need to use proxy too

@sm2017
Copy link
Author

sm2017 commented Jun 10, 2019

@np-maintain can you help me?

@MarcoScabbiolo
Copy link
Contributor

Can you explain your use case further?

@sm2017
Copy link
Author

sm2017 commented Jun 10, 2019

I want to keep alive http connections to remove TCP overheads and increase performance
In nodejs HTTP(s) agent has a keepAlive option, your proxy agent has not

https://nodejs.org/api/http.html#http_new_agent_options

keepAlive Keep sockets around even when there are no outstanding requests, so they can be used for future requests without having to reestablish a TCP connection. Not to be confused with the keep-alive value of the Connection header. The Connection: keep-alive header is always sent when using an agent except when the Connection header is explicitly specified or when the keepAlive and maxSockets options are respectively set to false and Infinity, in which case Connection: close will be used. Default: false

https://github.com/sindresorhus/package-json/blob/af8851efb342111d098ca38d3ed51f9007fbf146/index.js#L10-L17

@sm2017
Copy link
Author

sm2017 commented Jun 14, 2019

@MarcoScabbiolo reply please

@MarcoScabbiolo
Copy link
Contributor

MarcoScabbiolo commented Jun 14, 2019

Currently the options used to create an Agent are hand picked from the supported options to initialize, so there is no way to do it.

See

var opts = {

I'm thinking the best way to go would be to add an agent property to the initialize options that includes all of the Node Agent options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants