WebThingsIO / gateway

WebThings Gateway
http://webthings.io/gateway
Mozilla Public License 2.0
2.61k stars 334 forks source link

Support http2 #1145

Open hobinjk opened 6 years ago

hobinjk commented 6 years ago

Unfortunately, node's built-in support for http2 is still experimental so this likely should not be done until there's a stabler way to do it.

sogaani commented 6 years ago

Node's built-in http2 has graduated from experimental. https://github.com/nodejs/node/pull/22466 Unfortunately, http framework express used in the Gateway still not support http/2 and websocket over http2 is supported only Chrome. I think there is some option to use http2. As, fastly and koa alternative to express seems to support http2. We might be able to use Server side event for the browser to watch things changes. Server side event does not depend on http version.

benfrancis commented 6 years ago

Node's built-in http2 has graduated from experimental. nodejs/node#22466 Unfortunately, http framework express used in the Gateway still not support http/2 and websocket over http2 is supported only Chrome.

Good to know!

As, fastly and koa alternative to express seems to support http2. We might be able to use Server side event for the browser to watch things changes. Server side event does not depend on http version.

I don't think we should switch our whole web app to fastly or koa just for this. I hope Express will get HTTP/2 support soon.

Server Sent Events are an interesting alternative to WebSockets which I know some W3C members have been using. Unfortunately they are not supported in IE or Edge yet, but you can vote for them here!

mrstegeman commented 6 years ago

It looks like express should support HTTP/2 just fine: https://github.com/expressjs/express/issues/2364

We'll have to wait until we make the switch to Node v10 (when it becomes LTS) to start using it, though, as it is still experimental in 8.X.

sogaani commented 6 years ago

It looks like express should support HTTP/2 just fine: expressjs/express#2364

It is about spdy or node-http2. We can use those module. However, if we use build-in http2, we should wait https://github.com/expressjs/express/pull/3390 landing.

Unfortunately they are not supported in IE or Edge yet, but you can vote for them here!

I vote it! Furthermore, SSE with IE or Edge has polyfill, if they not support.

mrstegeman commented 6 years ago

@sogaani Ah! The comments in the other issue made it sound like it was just supported. That's confusing.

benfrancis commented 6 years ago

It would be interesting to do a prototype/architectural spike with one of those packages to see if Martin's proposed local HTTPS solution works (https://github.com/mozilla-iot/gateway/issues/171#issuecomment-398855965). If it does then this is something we could prioritise, maybe even contribute to getting HTTP/2 supported in Express sooner.

mrstegeman commented 6 years ago

@sogaani is already trying to get HTTP/2 support for us 😄

hobinjk commented 6 years ago

PageKite should support HTTP2 with no major modifications. (I had a moment of doubt before I looked into it)