Streaming response from CocoaHTTPServer for use with EventSource

353 views Asked by At

I'm trying to figure out how to leave a connection open with CocoaHTTPServer in order to make use of 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.

1

There are 1 answers

0
Fjölnir On

The version of mongoose used by HTTPKit is MIT licensed and does not require any payment for commercial use.