Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

110
Views
XMLHttpRequest HTTP and re-use of connections

Say one do multiple requests to example.com/some/api by XHR.

If one do:

let xhr = new XMLHttpRequest();
xhr.open('GET', 'https:/example.com/some/api?' + query);
xhr.send();

each time, does that make a new connection each time, handshake and all?

And if one reuse the xhr it re-uses the connection if kept alive?

Does it create a new connection each time, or re-use independent on the object, or anything in between?

From what I understand HTTP/2 does not have keep-alive but more in a way of keep connection open as a default. For HTTP/1.1 it depends on headers?


Main thought is that it is better to re-use the xhr if there is a new connection for each object. And on the contrary, if it is handled deeper in the system it's nothing much to twiddle with.

And as a second point is it enough to check for readyState if re-using? If it is 4, is it OK to re-use?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!