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

http/2 support #167

Open
kobenguyent opened this issue Jun 14, 2024 · 3 comments
Open

http/2 support #167

kobenguyent opened this issue Jun 14, 2024 · 3 comments

Comments

@kobenguyent
Copy link
Collaborator

currently I think we are using node-fetch for making requests. Do we consider another lib like https://github.com/sindresorhus/got?tab=readme-ov-file that supports http/2?

A Quick Overview of HTTP/2
HTTP/2 is a new Protocol that is replacing HTTP/1.1 thats currently de-facto standard of web.
Main motivation behind it is Performance.
Its backward compatible. Clients and browsers can use HTTP/1.1 as usual if they don’t support HTTP/2.
With HTTP/2, SSL is recommended for performance reasons, but not compulsory.

@flawiddsouza
Copy link
Owner

Sounds like a good idea. Didn't realize that web-standalone was using node-fetch. We'll have to change it to use https://github.com/nodejs/undici instead of node-fetch, as that's what we use in electron. This is what nodejs itself uses to provide the fetch api. We use the npm installed package as it provides the latest fixes and nodejs itself takes time to upstream the fixes. undici (fetch) seems to have http2 support as noted in this test: https://github.com/nodejs/undici/blob/981fb3d72a4393f77c9f28e3ea2f77dc4cf6e9ad/test/fetch/http2.js#L46. Just need to make some time to implement this. Should be possible with minimal code changes.

undici provides the same Fetch API interface as node-fetch and browser fetch, so that should make things simple.

got seems to also recommend a newer library called ky which implements the Fetch API interface:
image

@kobenguyent
Copy link
Collaborator Author

ky is small indeed but it doesn't support http/2 as listed here https://github.com/sindresorhus/got?tab=readme-ov-file#comparison
Screenshot 2024-06-14 at 15 34 15

@flawiddsouza
Copy link
Owner

http2 requests are now implemented in electron as of this commit: 42cfb80. web-standalone / docker is still pending.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants