Saturday, 7 September 2013

Streaming response from CocoaHTTPServer for use with EventSource

Streaming response from CocoaHTTPServer for use with EventSource

I'm trying to figure out how to leave a connection open with
CocoaHTTPServer in order to make use of EventSource i.e. Server Sent
Events (SSE)... along the lines of
http://tenderlovemaking.com/2012/07/30/is-it-live.html
I can set the content type to text/event-stream, however I need to keep
the connection open and be able to continually write responses until it's
either closed manually or by the client.
This is now possible with HTTPKit
https://github.com/fjolnir/HTTPKit/issues/4 (thanks to Fjölnir Ásgeirsson)
but it uses Mongoose which has a rather expensive commercial licence fee
and therefore I need to use CocoaHTTPServer or another solution.
Any solutions are most welcome.

No comments:

Post a Comment