Is HTTP/2 implementation possible?
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 :).
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 :)
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.