simple-sse-nodejs-setup icon indicating copy to clipboard operation
simple-sse-nodejs-setup copied to clipboard

Is HTTP/2 implementation possible?

Open devsumanmdn opened this issue 6 years ago • 2 comments

I have a really hard time implementing SSE over http2, with http/1.1 it works fine, but as you have mentioned in your blog, I thought it will be using HTTP/2.

Any info regarding this will be really helpful, thank you :).

devsumanmdn avatar Aug 01 '19 07:08 devsumanmdn

Hey, I haven't played around with the HTTP/2 module of nodejs. It looks like the same as HTTP in their docs: https://nodejs.org/api/http2.html

I guess your issue comes from the fact you need a certificate?

On general the good practice is to separate the infra and the implementation. For example your gateway should be handling the HTTP/2 and certificates. In our company we use NGINX in front of our servers to handle exactly this.

Feel free to setup something and send PR, I will try fixing whatever is not working for you :)

mchaov avatar Aug 02 '19 08:08 mchaov

I guess your issue comes from the fact you need a certificate?

No, I'm using mkcert for generating certificates, the issue is that Connection and Keep-Alive are ignored in HTTP/2 (read more) https://github.com/mchaov/simple-sse-nodejs-setup/blob/62ad99b0d40019d8aa3d885d6216d2ffd217dbde/server.js#L33

Feel free to setup something and send PR, I will try fixing whatever is not working for you :)

Thanks a lot, I'll try creating a PR with HTTP/2. If you find something please share.

devsumanmdn avatar Aug 03 '19 09:08 devsumanmdn