I have written a comet-like server. It is very basic and only uses
event-source and Mozilla's mixed/x-multipart-replace method. I am not
storing the events on the server so it would need to be modified to
use a hacky long-polling technique.
You can have a look at my code here, it works for my needs. It needs
some work to handle reconnecting clients.
http://go.anykeysoftware.co.uk/evtserver-0.1.tar.gz
As you can see, I only need the Hijack command so that I can close
connections when clients disconnect. One go routine is launched for
each connected client which just tries to read from the connection.
I have tested it with WebKit nightly and Mozilla and both of them can
hold an open connection for hours. I don't think it is necessary to
keep the connection alive manually.
It has a few comments but if you have any questions (or patches),
please let me know. I am using 6g so if you use 8g then modify the
Makefile.
Events are sent in the format name:data to port 9057 (UDP by default)
and clients connect to TCP 9058 with the url /listen/type. The first
connection by a client will give a client_id which they must then use
to register for events by making a get request to /register/....
Regards
Mike