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

vscode extesion http keep-alive problem #896

Closed
Tracked by #922
alonWang opened this issue Jul 9, 2023 · 1 comment
Closed
Tracked by #922

vscode extesion http keep-alive problem #896

alonWang opened this issue Jul 9, 2023 · 1 comment
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)

Comments

@alonWang
Copy link

alonWang commented Jul 9, 2023

The following code:

let XXXXX = new http.Agent({ keepAlive: true, maxSockets: 1})
for(let i=0;i<3;i++){
http.get({
hostname: 'localhost',
method:'GET',
port: 23659,
path: '/api/get/alive',
agent:XXXXX
}, resp => {
resp.on('data', data => {
console.log('data',data)
});
for (const key in XXXXX.sockets) {
console.log(key)
// if (XXXXX.sockets.hasOwnProperty(key)) {
// console.log(key + ": ", XXXXX.sockets[key]);
}
}).end()
}

When run in a VS Code plugin and capturing packets using Wireshark, you observed:

Connection: close

When run in a regular npm project, you observed:

Connection: keep-alive

I have been struggling with this issue for two days. Could you please help me take a look?

@mjbvz mjbvz added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label Oct 2, 2023
@vscodenpa
Copy link
Collaborator

Please ask your question on StackOverflow. We have a great community over there. They have already answered thousands of questions and are happy to answer yours as well. See also our issue reporting guidelines.

Happy Coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

3 participants