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:
Echo serialized GET params:
Sending GET params:
I have a number of other gists: https://gist.github.com/gists/search?q=eventsource&page=1
A quickstart guide to EventSource:
A mini-web-chat written with EventSource:
https://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.