Hi,
Server-Sent Events is a new HTML5 technology that is used to send data from a server to a client, over HTTP, on the initiative of the server.
Here are some references:
http://en.wikipedia.org/wiki/Server-sent_events http://dev.w3.org/html5/eventsource/ https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_eventsZinc-Server-Sent-Events is a proof of concept implementation with a small demo of Server-Sent Events for Zinc HTTP Components in Pharo.
Usage in quite simple: you specify a handler object that implements a #run: method for each outgoing feed, like this
run: connection
"Using Server-Sent Events is simple: keep a reference to the connection,
instanciate ZnServerSentEvent objects and use #writeOn: to push them out."
| event status |
[
status := self statusString.
event := ZnServerSentEvent type: 'status-update' data: status.
event writeOn: connection.
2 seconds asDelay wait ] repeat
On the client side, a standard JavaScript listener will receive the incoming events.
The package can be found here
http://www.smalltalkhub.com/#!/~SvenVanCaekenberghe/ZincHTTPComponents/packages/Zinc-Server-Sent-EventsMake sure to update Zinc itself to its bleedingEdge first.
Sven
--
Sven Van Caekenberghe
http://stfx.euSmalltalk is the Red Pill