Skip to content

How are HTTP/2 connections managed? #1316

Answered by szmarczak
JustinBeckwith asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry for late reply, I haven't been able to do much coding in the past month. I'm more than happy to answer your questions.

How are you managing the underlying ClientHttp2Session objects?

I could talk about this for ages: http2-wrapper/source/agent.js
If you got any specific questions, please ask right away.

If I make two HTTP requests in a row, is it going to re-use the same underlying connection?

Yes. There is a queue.

If you are re-using connections, how do you know when to close the session?

Good question. If a session's origin set is a subset of another session's origin set, it's closed. Another example is when maxFreeSessions option is set to 0. A session can be created when …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sindresorhus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1316 on December 10, 2020 17:18.