title: Use a "x-dom-event-stream" stream in javascript?
body: <p>HTML5 draft contains an API called <a href="http://dev.w3.org/html5/eventsource/" rel="nofollow noreferrer">EventSource</a> to stream data (notifications) trough javascript using only one server call.</p>
  
  <p>Looking it up, I found an exemple on <a href="http://labs.opera.com/news/2006/09/01/" rel="nofollow noreferrer">Opera Labs</a> of the javascript part : </p>
  
  <pre><code>document.getElementsByTagName("event-source")[0]
          .addEventListener("server-time", eventHandler, false);
  
  function eventHandler(event)
  {
      // Alert time sent by the server
      alert(event.data); 
  }
  </code></pre>
  
  <p>and the server side part : </p>
  
  <pre><code>&lt;?php
  header("Content-Type: application/x-dom-event-stream");
  while(true) {
      echo "Event: server-time\n";
      $time = time();
      echo "data: $time\n";
      echo "\n";
      flush();
      sleep(3);
  }
  ?&gt;
  </code></pre>
  
  <p>But as of today, it seems only Opera has implemented the API, neither Chrome nor Safari have a working version (Am I wrong here ?)</p>
  
  <p>So my question is, is there any other way in javascript, maybe more complex, to use this one stream to get data ?</p>
  
  <p>EDIT : I'm looking at Comet stuff right now, but I'm not sure how to reuse that :)
  EDIT 2 : Apparentry, "x-dom-event-stream" has now been renamed "text/event-stream"
  EDIT 3 : Got to understand way more of it with this <a href="http://today.java.net/article/2010/03/31/html5-server-push-technologies-part-1" rel="nofollow noreferrer">recent article</a> from javanet</p>