<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">OK, on connected I could send say the 10 “events” which occurred since “lastEventId”.
<div><br /></div>
<div>Once the connection has been established/connected, where do I send the next N events, that maybe occur minutes after the initial “connected”.</div>
<div><br /></div>
<div>In my mind I thought this all occurred inside “connected”. &#160;Meaning connected would wait until some new events were available, send those, ad infinitum. &#160;</div>
<div><br /></div>
<div>Thanks,</div>
<div><br /></div>
<div>Ryan</div>
<div><br /></div>
</div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br />
On May 1, 2017, 6:20 PM -0600, Stuart Douglas &lt;sdouglas@redhat.com&gt;, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">When you send you are blocking the IO thread, so the events don't<br />
actually get put on the wire till the IO thread returns.<br />
<br />
Stuart<br />
<br />
On Tue, May 2, 2017 at 7:54 AM, Ryan Dewell &lt;ryan@dewell.org&gt; wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #e67e22;">Playing around at the moment, and missing something about the threading<br />
situation as it pertains to sending events.<br />
<br />
In my ServerSentEventConnectionCallback:<br />
<br />
public void connected(ServerSentEventConnection connection, String<br />
lastEventId) {<br />
try {<br />
for (int i = 0; i&lt;10; i++){<br />
connection.send("i="+i);<br />
Thread.sleep(1000);<br />
}<br />
} catch (Exception e) {<br />
throw new RuntimeException(e);<br />
}<br />
}<br />
<br />
Sending events, with one second between each.<br />
<br />
I’d expect the time between events to be reflected in the browser / client.<br />
However what instead happens is all 10 events arrive within the same<br />
millisecond (nanoseconds apart according to Chrome console time).<br />
<br />
So I’m missing something here. But I don’t see anything obvious. For<br />
example, there is nothing like a “flush()” on ServerSentEventConnection that<br />
could be used after each event is sent.<br />
<br />
Ideas/guidance?<br />
<br />
Thanks!<br />
<br />
Ryan<br />
<br />
<br />
_______________________________________________<br />
undertow-dev mailing list<br />
undertow-dev@lists.jboss.org<br />
https://lists.jboss.org/mailman/listinfo/undertow-dev<br /></blockquote>
</blockquote>
</div>
</body>
</html>