-
-
Notifications
You must be signed in to change notification settings - Fork 17.4k
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 #2364
Comments
SPDY ?? |
Yes |
I was under the impression that you can already do that with
and
|
Well I would guess that spdy is definitely off the roadmap, spdy being an experimental protocol. http2 is most probably getting standardized one day. I the meantime, it is (almost) easily implemented in userland with the http2 module which uses a signature similar to the core http/https modules server push is a method of the http2 response object and I would assume express passes it on transparently. |
Express has nothing to do with the underlying HTTP protocol version. It already supports HTTP2. Here is an example with the var express = require('express')
var app = express()
app.get('/', function (req, res) {
res.send('hello, http2!')
})
var options = {
key: fs.readFileSync('./example/localhost.key'),
cert: fs.readFileSync('./example/localhost.crt')
};
require('http2').createServer(options, app).listen(8080); |
@alejonext I'm not sure I understand your comment--Express has supported HTTP2/SPDY for a long time. |
Ha! ok @dougwilson |
Upon reading http2 docs im under impression that you need to write code for server push both on client side and server... is this true? And isnt server push the greatest benefit, to be able send alresources required together and avoid separate requests. |
This is absolutely true, though I think you can use a module like https://github.com/jshttp/spdy-push ? I'm not that familiar, but Express does not have any knowledge of the underlying protocol version (or even the socket), since at it's core, all Express is is a You can always extend your Express like var express = require('express')
var app = express()
express.response.push = /* define some method that will become res.push() in your app */ |
I agree with what @dougwilson says above and where this conversation ended up. http2/spdy should be implemented at a lower level then express and be pretty much transparent to express itself. |
Does this code still work?
I tried the same thing with newest versions and got an error.
Node: v0.12.0 |
File an issue at https://github.com/molnarg/node-http2 |
For people still dropping by here, use https://github.com/indutny/node-spdy instead of https://github.com/molnarg/node-http2 The |
Would be nice if Express had http 2 support on the roadmap, now that all major browsers support it in their current versions. So I am tossing it in here.
The text was updated successfully, but these errors were encountered: