Server Sent Events

Skip to first unread message

Timothy Perrett

Dec 27, 2014, 1:41:49 AM12/27/14
Hey gang,

Stumbled across this:

And implemented it in a toy i'm building over the holidays (plus a little upgrading to work with 8.4). However, given:

λ curl -vG --no-buffer -H "Accept: text/event-stream"

The connection does not stay open, it simply serves a single response and closes the connection. How do I keep the connection open and have it properly stream?

Cheers, Tim

Doug Tangren

Dec 27, 2014, 11:04:21 AM12/27/14

If you dig into you'll find a class called requestbinding. It's what req refers to in that gist.

If you want to stream msgs you can call underlying I think which gives you a ref to recieved message which should allow you to gain access to the netty channel which you can write msgs to. It's up to you to close the connection. Could probably do that with a listener on the channels close future.

Hope that helps. I'm in rural country with family for the holidays and only a mobile phone so typing up that in a new gist is a little awkward on my phone :)

> Cheers, Tim
> --
> You received this message because you are subscribed to the Google Groups "Unfiltered" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> For more options, visit

Timothy Perrett

Dec 28, 2014, 12:16:57 AM12/28/14
Thanks Doug - i'm also out for the holidays, so i'll take a look in the coming days and let you know!


Timothy Perrett

Dec 29, 2014, 6:00:49 PM12/29/14
So I tried writing directly to the channel, but im really not familiar with how Netty works and how its bound to unfiltered. 

Blindly writing to the channel doesn't work, and even something more sophisticated using a responder that writes to the output stream of the channel didn't work either. It's not as straight forward as one would probably like :-( 

Basically I have a and I want to stream it via HTTP :-)

-- T
Reply all
Reply to author
0 new messages