I am using Netty 4.1-Beta6 version.
I want to support the use case where the HTTP2 server should be able to push events to the HTTP2 client on an existing connection - this could be an alarm or timer event from the cloud which needs to be propagated to the client.
I am thinking of using 'Server Sent Event' feature - is it possible to do this with HTTP2 in Netty, if so, how? Should I keep a http2 stream open by sending data frames with 'final frame' flag set to false? When I try this, what I observe is that the content gets buffered. The data frame doesn't reach the client as and when I write. I am using the DefaultHttp2Encoder. I tried setting the 'Transfer-Encoding' header to 'chunked' too.
Related question - does HTTP2 allows bi-directional data frames once the stream is in 'open' state? The idea is that the server should be able ask data from the client and client should be able to respond with the data in the same stream (reversal of client/server role once the stream is established). Is this possible?
Thanks in advance for the help.
I played with Netty bit more. Here is what I found for the 2 questions above.
I have uploaded my sample here - https://github.com/skssfo/http2
I am playing with Netty for the first time, it is very cool. Nice job Netty team!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With