I originally wrote this as a comment on Mozilla’s “Aurora 6 Is Here” article - but I’m impatient and couldn’t wait for the comment to be moderated. Also, I haven’t posted in a while and figured Bob the Rooster would appreciate it.
Glad to see support for the EventSource API has made it to Firefox.
There is a major flaw in all existing implementations in that they do not actually open a “listener” for some sort of event that is generated and sent from the server. What has actually been implemented is the equivalent to a native polling mechanism, which is useful none-the-less.
Last fall I released a test supported (unit and spec tests) jQuery extension that provides a unified API (using XHR as fallback). https://github.com/rwldrn/jquery.eventsource
Additionally, I’ve created these useful EventSource API tests, snippets and demos:
Serializing Array to JSON data: https://gist.github.com/415294
Echo serialized GET params: https://gist.github.com/415836
Sending GET params: https://gist.github.com/415836
I have a number of other gists: https://gist.github.com/gists/search?q=eventsource&page=1
A quickstart guide to EventSource: http://bocoup.com/weblog/chrome-6-server-sent-events-with-new-eventsource
A mini-web-chat written with EventSource: http://bocoup.com/weblog/jquery-eventsource-yakyakface-com & http://yakyakface.com
Now that Firefox, Chrome and Opera have implemented the EventSource API, I think it’s a safe and viable addition to our development tool kits.