[Pharo-dev] Zinc-Server-Sent-Events

Sven Van Caekenberghe sven at stfx.eu
Thu Aug 29 10:04:12 EDT 2013


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:


Zinc-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


Make sure to update Zinc itself to its bleedingEdge first.


Sven Van Caekenberghe
Smalltalk is the Red Pill

More information about the Pharo-dev mailing list