Via reddit, I came across news that Opera supports server-sent-events (aka SSE). The SSE model for streaming events is very similar to the model used by StreamBase, so last night I whipped up a simple little StreamBase to SSE adapter.
The SSE protocol is admirably simple. For example, the event stream from an SSE server might look like this:
HTTP/1.1 200 OK Content-Type: application/x-dom-event-stream Event: stock-quote Ticker: MSFT Price: 25.84 Event: weather-forecast Date: 2006-09-02 Zip-code: 02445 High-Temp: 68F Chance-of-rain: 30 Event: instant-message From: aoluser123 Text: l8r, d00d!
My only dislike about the SSE spec is that it combines generic event streams with DOM-specific semantics. For example, the special treatment of the "Bubbles" attribute muddies the distinction between the model (the event stream itself) and the view (the web page receiving the events). Similarly, the fact that a "Click" event is automatically treated as having a "MouseEvent" class muddies the distinction between the the model and the controller.
I think it's very inappropriate for a spec to combine these things. It's like having the DNS specification talk about HTTP, or having the HTML spec talk about Flash. I think this confusion is the main reason why the Opera folks think it's reasonable to only support the "data" attribute in SSE events. That may make sense in the context of the DOM, but in terms of generic event streams, it's completely brain dead.
Posted on September 2, 2006 09:41 PM
More work articles