+ 1

How does promise.all works?

I went through some articles and came to the conclusion that promise.all work similarly to multiplexing in http 2 , so am i right ? ty!

16th Aug 2021, 6:48 PM
Abhay
Abhay - avatar
3 Réponses
+ 4
Abhay I wouldn't try to compare multiplexing in HTTP/2 with Promises as these concepts are fundamentally different and may cause more confusion for either you or the people you're talking to. Even if you could rationalize a highly abstract comparison between the two, the odds of multiple people sharing that same understanding is probably low. Furthermore, the question assumes you and all respondents have the same understanding of both Promises and HTTP/2, which in this community, there's a risk of that being the case. 😉 In answering your question, you can probably guess, I wouldn't agree at all that Promise.all([...]) is even remotely similar to multiplexing in HTTP/2. However, I'm open to hearing your case for what you find to be similar. 😉 Also, what are the articles you're reading that led you to this conclusion? I'd be interested to see if they are flawed or actually shed some light on this which I haven't considered.
17th Aug 2021, 6:14 PM
David Carroll
David Carroll - avatar
+ 2
Runtime Terror ty for the response and i do understand that working. But i want to know what actually happens . I mean does it make make continuous requests without waiting for the previous one to finish and then wait for the responses from all them (similarly to how multiplexing works in http 2?) . I want to correlate it with http 2 so i actually understand what is going on . And does promise all opens several connections or just single connection (like http 2)? Ty!
17th Aug 2021, 10:45 AM
Abhay
Abhay - avatar