-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
http2 support #1193
Comments
I am not about creating and starting the server - it is simple, I am about pushing resources, methods signatures and so |
While require('http2').createSecureServer(cert, new Koa().callback()).listen() is really neat and simple, I believe that something along the lines of new Koa({
http2: {
cert: ...,
key: ...,
enabled: true | false // Optional for debugging
}
}) could be very helpful and really not a big addition in terms of codebase and complexity. It's the same reason why we don't use require('http').createServer(new Koa().callback()).listen() Any thoughts on the matter? |
@cupcakearmy That proposal was turned down in #1063, I added a summary in this comment |
if I have to use callback syntax - then why do I need koa ??? |
I am about somthing like a push method in express ... |
@budarin Nobody said not to expand Koa support for HTTP/2, let's wait and see what happens. |
what year can we see it? :) |
We think about migration from |
Hey @evilebottnawi, FYI I can get koa work with http2. This is the code that I am using const http = require('http');
const http2 = require('http2');
const Koa = require('koa');
const app = new Koa();
// response
app.use(ctx => {
ctx.body = 'Hello Koa';
});
http.createServer(app.callback()).listen(80);
http2.createSecureServer({
"key": certificate,
"cert": certificate
}, app.callback()).listen(443); |
i've looked at this a long time ago, and adding push support was complicated and did not provide much benefit. koa would basically just set headers in the stream, but you'd still need to pipe data to the stream yourself. this might be better as a framework using koa than supported in koa itself let us know if you have any API recommendations |
HTTP/2 already works with Koa. See https://github.com/ladjs/web/blob/master/index.js for an example (note the lines are currently commented out because there is a core bug in Node with HTTP/2 XHR requests; they do not work). See https://www.theregister.com/2020/08/18/nodejs_chromium_patch/. Ref: nodejs/node#33875 and <https://bugs.chromium.org/p/chromium/issues/detail?id=1045328#c46 |
http2 is out in node 10.0.0.
will http 2 be supported by the library?
The text was updated successfully, but these errors were encountered: