<div dir="ltr">Hello, <div>We are trying to use both SSE and HTTP/2.0 features of Undertow. The idea is to open an SSE connection with HTTP/2.0 as protocol.</div><div>We&#39;ve tried with the following piece of code:</div><div><br></div><div>____________________________________________</div><div><br></div><div><div>        ServerSentEventHandler sseHandler;</div><div>        sseHandler = new ServerSentEventHandler(new SseConnectionCallback(source));</div><div><br></div><div>        String bindAddress = System.getProperty(&quot;bind.address&quot;, &quot;localhost&quot;);</div><div>        SSLContext sslContext = createSSLContext(loadKeyStore(&quot;server.keystore&quot;), loadKeyStore(&quot;server.truststore&quot;));</div><div>        Undertow server = Undertow.builder()</div><div>                .setServerOption(UndertowOptions.ENABLE_HTTP2, true)</div><div>                .setServerOption(UndertowOptions.ENABLE_SPDY, true)</div><div>                .addHttpsListener(8443, bindAddress, sslContext)</div><div>                        .setHandler(path().addPrefixPath(&quot;/sse&quot;, sseHandler))</div><div>                .build();</div><div><br></div><div>        server.start();</div></div><div>____________________________________________<br></div><div><br></div><div>But when connecting to <a href="https://localhost:8443/sse">https://localhost:8443/sse</a>, nothing happens in the client side while we are sending into the ServerSentEventConnection data every 5 seconds<br></div><div>We think it is related to the HTTP/2.0 frame stuff but we are not sure about this hypothesis. </div><div>On the other hand, we have modified the ServerSentEventConnection to expose a flush() method that calls the underlying flush() of its sink.</div><div><br></div><div>____________________________________________<br></div><div><br></div><div><div>public class ServerSentEventConnection implements Channel, Attachable {</div><div><br></div><div>   ...</div><div><br></div><div>    public boolean flush() throws IOException {</div><div>        return this.sink.flush();</div><div>    }</div></div><div>}</div><div><br></div><div>____________________________________________<br></div><div><br></div><div><br></div><div>And somewhere in our callback, we do:</div><div><br></div><div>____________________________________________<br></div><div><br></div><div><div>public class SseConnectionCallback implements ServerSentEventConnectionCallback {</div><div>   </div><div>   ...</div><div>            if (connection.isOpen()) {</div><div>                connection.send(data, &quot;data&quot;, UUID.randomUUID().toString(), new ServerSentEventConnection.EventCallback() {</div><div>                    @Override</div><div>                    public void done(ServerSentEventConnection aConnection, String aData, String aEvent, String aId) {</div><div>                        LOGGER.info(&quot;Sent!&quot;);</div><div>                        try {</div><div>                            connection.flush();</div><div>                        } catch (IOException e) {</div><div>                            e.printStackTrace();</div><div>                        }</div><div>                    }</div><div><br></div><div>                    @Override</div><div>                    public void failed(ServerSentEventConnection aConnection, String aData, String aEvent, String aId, IOException e) {</div><div>                        LOGGER.info(&quot;failed!&quot;);</div><div>                    }</div><div><br></div><div>               }); </div><div>}</div></div><div>____________________________________________<br></div><div><br></div><div><br></div><div>And we get the SSE events on the client side. So, we were wondering whether our solution was right or whether there is another solution for our issue.</div><div><br></div><div>Thanks in advance!</div><div>Best regards,</div><div><br></div><div>Cédric.</div><div><br></div><div><br></div><div><br></div></div>