Yeah, that sounds great. Our audience has a lot of questions for you. But I have even more. One thing, so you talked about the Node implementation of Fetch. And I'm also quite excited about that. I hope everyone is. Does it use undici? Does it have anything in common?
Yes. So actually, the Fetch in Node is built on top of undici. We don't expose anything from undici other than Fetch in Node, and that's a conscious decision in order to not to expose two experimental APIs that can later change and break. But the implementation of Fetch is done on top of undici, and not the normal Node HTTP code.
That's awesome. I suppose that everybody running Node would essentially be in undici now. So that's the best way to…
Oh, we have a question by our speaker, Joda Developer, who asked, how to mock a request in undici? So for example, there is a Nock library that allows you to mock requests. So if you're using undici requests, have you tried mocking it? And how would you do that?
So Nock doesn't work because it depends on the internals of the HTTP client. We have mocking implemented in undici. So there's mock client and mock pool and the tools that are required to basically do the same thing you would do with Nock. So it's all there.
That is awesome. Also agentil1990 asks, what is the support for Qwik like in the future? I know NodeCore supports Qwik now, right? But what about undicis?
So NodeCore does not support Qwik yet. I think it landed as experimental, but then was later removed. There is a PR that James is working on for landing it. Unless I missed something, but once that's landed, it should be quite easy to add support for that in undici to implement HTTP1 over Qwik. Implementing HTTP3 support is a little bit more work.
That sounds really interesting. Thank you. Another question is, is there any benchmark on the overhead from creating a new connection every time as opposed to the undici approach?
So we have some benchmarks included. And yeah, it's hard to say where all our performance improvements come from. And again, it depends on your use case. But I would say it's significantly faster to keep their reuse connections than opening and closing them all the time, especially in terms of latency.
I see.
Comments