NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 85 - * Made it possible to adjust the reconnection timeout.<br> * Made it so that the client tells the server what the last message it <br> received was when it reconnects, so as to allow seamless continuation. <br> * Rewrote the implementation processing...
* Made it possible to adjust the reconnection timeout.<br> * Made it so that ...
Status: RESOLVED INTENTIONAL
Product: Validator.nu
Classification: Unclassified
Component: General
HEAD
All All
: P2 normal
Assigned To: Henri Sivonen
http://svn.whatwg.org/webapps/source?...
: 123 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-03 13:06 CET by Nobody
Modified: 2008-03-05 22:19 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nobody 2008-03-03 13:06:44 CET
Index: source
===================================================================
--- source	(revision 1236)
+++ source	(revision 1237)
@@ -4441,7 +4441,8 @@
 &lt;/html&gt;</pre>
 
    <p>...because the data placed in the cells is clearly not tabular
-   data. A corrected version of this document might be:</p>
+   data (and the <code>cite</code> element mis-used). A corrected
+   version of this document might be:</p>
 
    <pre>&lt;!DOCTYPE html&gt;
 &lt;html lang="en-GB"&gt;
@@ -4451,7 +4452,7 @@
    &lt;p&gt; My favourite animal is the cat. &lt;/p&gt;
   &lt;/blockquote&gt;
   &lt;p&gt;
-   &mdash;&lt;a href="http://example.org/~ernest/"&gt;&lt;cite&gt;Ernest&lt;/cite&gt;&lt;/a&gt;,
+   &mdash;&lt;a href="http://example.org/~ernest/"&gt;Ernest&lt;/a&gt;,
    in an essay from 1992
   &lt;/p&gt;
  &lt;/body&gt;
@@ -18790,8 +18791,7 @@
 
   <p>The <dfn title="attr-event-source-src"><code>src</code></dfn>
   attribute, if specified, must give a URI (or IRI) pointing to a
-  resource that uses the <code>application/x-dom-event-stream</code>
-  format.</p>
+  resource that uses the <code>text/event-stream</code> format.</p>
 
   <p>When the element is inserted into the document, if it has the
   <code title="attr-event-source-src">src</code> attribute specified,
@@ -32767,7 +32767,8 @@
   <h4>The <dfn><code>RemoteEventTarget</code></dfn> interface</h4>
 
   <p>Any object that implements the <code>EventTarget</code> interface
-  must also implement the <code>RemoteEventTarget</code> interface.</p>
+  must also implement the <code>RemoteEventTarget</code>
+  interface.</p>
 
   <pre class="idl">interface <dfn>RemoteEventTarget</dfn> {
   void <span title="dom-RemoteEventTarget-addEventSource">addEventSource</span>(in DOMString src);
@@ -32818,6 +32819,22 @@
   FEED character, block buffering or line buffering with different
   expected line endings can cause delays in event dispatch.</p>
 
+  <p>Each event source in the list must have associated with it the
+  following:</p>
+
+  <ul>
+
+   <li>The <dfn
+   title="concept-event-stream-reconnection-time">reconnection
+   time</dfn>, in milliseconds. This must initially be a
+   user-agent-defined value, probably in the region of a few
+   seconds.</li>
+
+   <li>The <dfn title="concept-event-stream-last-event-id">last event
+   ID string</dfn>. This must initially be the empty string.</li>
+
+  </ul>
+
   <p>In general, the semantics of the transport protocol specified by
   the URIs for the event sources must be followed, including HTTP
   caching rules.</p>
@@ -32825,13 +32842,11 @@
   <p>For HTTP connections, the <code title="">Accept</code> header may
   be included; if included, it must only contain formats of event
   framing that are supported by the user agent (one of which must be
-  <code>application/x-dom-event-stream</code>, as described
-  below).</p>
+  <code>text/event-stream</code>, as described below).</p>
 
   <p>Other formats of event framing may also be supported in addition
-  to <code>application/x-dom-event-stream</code>, but this
-  specification does not define how they are to be parsed or
-  processed.</p>
+  to <code>text/event-stream</code>, but this specification does not
+  define how they are to be parsed or processed.</p>
 
   <p class="note">Such formats could include systems like SMS-push;
   for example servers could use <code title="">Accept</code> headers
@@ -32842,16 +32857,21 @@
   header in requests to bypass any caches for requests of event
   sources.</p>
 
+  <p>If the event source's last event ID string is not the empty
+  string, then a <code title="">Last-Event-ID</code> HTTP header must
+  be included with the request, whose value is the value of the event
+  source's last event ID string.</p>
+
   <p>For connections to domains other than <span>the document's
   domain</span>, the semantics of the Access-Control HTTP header must
-  be followed. <a href="#refsACCESSCONTROL">[ACCESSCONTROL]</a>
+  be followed. <a href="#refsACCESSCONTROL">[ACCESSCONTROL]</a> <!--
+  XXX define this better once that spec is more stable -->
 
   <p>HTTP 200 OK responses with a <span>Content-Type</span> header
-  specifying the type <code>application/x-dom-event-stream</code> that
-  are either from <span>the document's domain</span> or explicitly
-  allowed by the Access-Control HTTP headers must be processed line by
-  line <a href="#event-stream-interpretation">as described
-  below</a>.</p>
+  specifying the type <code>text/event-stream</code> that are either
+  from <span>the document's domain</span> or explicitly allowed by the
+  Access-Control HTTP headers must be processed line by line <a
+  href="#event-stream-interpretation">as described below</a>.</p>
 
   <p>For the purposes of such successfully opened event streams only,
   user agents should ignore HTTP cache headers, and instead assume
@@ -32860,14 +32880,13 @@
   <p>If such a resource completes loading (i.e. the entire HTTP
   response body is received or the connection itself closes), the user
   agent should request the event source resource again after a delay
-  of approximately five seconds.</p>
+  equal to the reconnection time of the event source.</p>
 
   <p>HTTP 200 OK responses that have a <span>Content-Type</span> other
-  than <code>application/x-dom-event-stream</code> (or some other
-  supported type), and HTTP responses whose Access-Control headers
-  indicate that the resource are not to be used, must be ignored and
-  must prevent the user agent from refetching the resource for that
-  event source.</p>
+  than <code>text/event-stream</code> (or some other supported type),
+  and HTTP responses whose Access-Control headers indicate that the
+  resource are not to be used, must be ignored and must prevent the
+  user agent from refetching the resource for that event source.</p>
 
   <p>HTTP 201 Created, 202 Accepted, 203 Non-Authoritative
   Information, and 206 Partial Content responses must be treated like
@@ -32879,7 +32898,8 @@
   <p>HTTP 204 No Content, and 205 Reset Content responses must be
   treated as if they were 200 OK responses with the right MIME type
   but no content, and should therefore cause the user agent to refetch
-  the resource after a short delay.</p>
+  the resource after a delay equal to the reconnection time of the
+  event source.</p>
 
   <p>HTTP 300 Multiple Choices responses should be handled
   automatically if possible (treating the responses as if they were
@@ -32901,8 +32921,8 @@
 
   <p>HTTP 304 Not Modified responses should be handled like HTTP 200
   OK responses, with the content coming from the user agent cache. A
-  new request should then be made after a short delay of approximately
-  five seconds.</p>
+  new request should then be made after a delay equal to the
+  reconnection time of the event source.</p>
 
   <p>HTTP 305 Use Proxy, HTTP 401 Unauthorized, and 407 Proxy
   Authentication Required should be treated transparently as for any
@@ -32928,16 +32948,14 @@
   <h4>Parsing an event stream</h4>
 
   <p>This event stream format's MIME type is
-  <code>application/x-dom-event-stream</code>.</p>
+  <code>text/event-stream</code>.</p>
 
   <p>The event stream format is (in pseudo-BNF):</p>
 
   <pre>&lt;stream&gt;          ::= &lt;bom&gt;? &lt;event&gt;*
-&lt;event&gt;           ::= [ &lt;comment&gt; | &lt;command&gt; | &lt;field&gt; ]* &lt;newline&gt;
-&lt;comment&gt;         ::= ';' &lt;any-char&gt;* &lt;newline&gt;
-&lt;command&gt;         ::= ':' &lt;any-char&gt;* &lt;newline&gt;
-&lt;field&gt;           ::= &lt;name&gt; [ ':' &lt;space&gt;? &lt;any-char&gt;* ]? &lt;newline&gt;
-&lt;name&gt;            ::= &lt;name-start-char&gt; &lt;name-char&gt;*
+&lt;event&gt;           ::= [ &lt;comment&gt; | &lt;field&gt; ]* &lt;newline&gt;
+&lt;comment&gt;         ::= &lt;colon&gt; &lt;any-char&gt;* &lt;newline&gt;
+&lt;field&gt;           ::= &lt;name-char&gt;+ [ &lt;colon&gt; &lt;space&gt;? &lt;any-char&gt;* ]? &lt;newline&gt;
 
 # characters:
 &lt;bom&gt;             ::= a single U+FEFF BYTE ORDER MARK character
@@ -32947,20 +32965,23 @@
                       | a single U+000D CARRIAGE RETURN character
                       | a single U+000A LINE FEED character
                       | the end of the file
-&lt;name-start-char&gt; ::= a single Unicode character other than
-                      ':', ';', U+000D CARRIAGE RETURN and U+000A LINE FEED
+&lt;colon&gt;           ::= a single U+003A COLON character (':')
 &lt;name-char&gt;       ::= a single Unicode character other than
-                      ':', U+000D CARRIAGE RETURN and U+000A LINE FEED
+                      U+003A COLON, U+000D CARRIAGE RETURN and U+000A LINE FEED
 &lt;any-char&gt;        ::= a single Unicode character other than
                       U+000D CARRIAGE RETURN and U+000A LINE FEED
 </pre>
 
   <p>Event streams in this format must always be encoded as
-  UTF-8. Lines must be separated by either a U+000D CARRIAGE RETURN
-  U+000A LINE FEED (CRLF) character pair, a single U+000A LINE FEED
-  (LF) character, or a single U+000D CARRIAGE RETURN (CR)
-  character. User agents must treat those three variants as equivalent
-  line terminators.</p>
+  UTF-8.</p>
+
+  <p>Lines must be separated by either a U+000D CARRIAGE RETURN U+000A
+  LINE FEED (CRLF) character pair, a single U+000A LINE FEED (LF)
+  character, or a single U+000D CARRIAGE RETURN (CR) character.</p>
+
+
+
+  <h4 id="event-stream-interpretation">Interpreting an event stream</h4>
 
   <p>Bytes or sequences of bytes that are not valid UTF-8 sequences
   must be interpreted as the U+FFFD REPLACEMENT CHARACTER.</p>
@@ -32969,294 +32990,154 @@
   any are present.</p>
 
   <p>The stream must then be parsed by reading everything line by
-  line, in blocks separated by blank lines. Comment lines (those
-  starting with the character ';') and command lines (those starting
-  with the character ':') must be ignored.</p>
-
-  <p>Command lines are reserved for future extensions.</p>
-
-  <!--XXX Lachlan says:
-    For the next version of server sent events, it might be useful if
-    authors could specify the retry interval for connections.
+  line, with a U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF)
+  character pair, a single U+000A LINE FEED (LF) character, a single
+  U+000D CARRIAGE RETURN (CR) character, and the end of the file being
+  the four ways in which a line can end.</p>
+
+  <p>When a stream is parsed, a <var title="">data</var> buffer and an
+  <var title="">event name</var> buffer must be associated with
+  it. They must be initialized to the empty string</p>
 
-    e.g. In cases where it is known that content is only updated at
-    specified intervals (e.g. once per minute), having the browser retry
-    the connection every 5 seconds and fire the event with the same
-    content may be excessive.
-
-    This could possibly be done using the :command syntax.
-
-    e.g.
-      Event: click
-      :retry 60000
-
-    The browser would then retry the connection in 60,000 milliseconds (1
-    minute).
-  -->
+  <p>Lines must be processed, in the order they are received, as
+  follows:</p>
 
-  <p>For each non-blank, non-comment, non-command line, the field name
-  must first be taken. This is everything on the line up to but not
-  including the first colon (':') or the line terminator, whichever
-  comes first. Then, if there was a colon, the data for that line must
-  be taken. This is everything after the colon, ignoring a single
-  space after the colon if there is one, up to the end of the line. If
-  there was no colon the data is the empty string.</p>
-
-  <div class="example">
-   <p>Examples:</p>
-   <pre>Field name:&nbsp;Field data</pre>
-   <pre>This is a blank field</pre>
-   <pre>1. These two lines:&nbsp;have the same data
-2. These two lines:have the same data</pre>
-   <pre>1. But these two lines:&nbsp; do not
-2. But these two lines:&nbsp;do not</pre>
-  </div>
-
-  <p>If a field name occurs multiple times in a block, the value for
-  that field in that black must consist of the data parts for each of
-  those lines, concatenated with U+000A LINE FEED characters between
-  them (regardless of what the line terminators used in the stream
-  actually are).</p>
-
-  <div class="example">
-   <p>For example, the following block:</p>
-   <pre>Test:&nbsp;Line 1
-Foo:&nbsp;&nbsp;Bar
-Test:&nbsp;Line 2</pre>
-   <p>...is treated as having two fields, one called <code>Test</code>
-   with the value "<code>Line 1\nLine 2</code>" (where <code>\n</code>
-   represents a newline), and one called <code>Foo</code> with the
-   value "<code>&nbsp;Bar</code>" (note the leading space
-   character).</p>
-  </div>
-
-  <p>A block thus consists of all the name-value pairs for its
-  fields. Command lines have no effect on blocks and are not
-  considered part of a block.</p>
+  <dl class="switch">
 
-  <p class="note">Since any random stream of characters matches the above
-  format, there is no need to define any error handling.</p>
+   <dt>If the line is empty (a blank line)</dt>
 
+   <dd><p><a href="#dispatchMessage">Dispatch the event</a>, as
+   defined below.</p></dd>
 
-  <h4 id="event-stream-interpretation">Interpreting an event stream</h4>
 
-  <p>Once the fields have been parsed, they are interpreted as follows
-  (these are case-sensitive exact comparisons):</p>
+   <dt>If the line starts with a U+003A COLON character (':')</dt>
 
-  <dl>
+   <dd><p>Ignore the line.</p></dd>
 
-   <dt><code title="">Event</code> field</dt>
 
-   <dd><p>This field gives the name of the event. For example, <code
-   title="">load</code>, <code title="">DOMActivate</code>, <code
-   title="">updateTicker</code>. If there is no field with this name,
-   the name <code title="event-message">message</code> must be
-   used.</p></dd>
-
-
-   <dt><code title="">Namespace</code> field</dt>
-
-   <dd><p>This field gives the DOM3 namespace for the event. (For
-   normal DOM events this would be null.) If it isn't specified the
-   event namespace is null.</p></dd>
-
-
-   <dt><code title="">Class</code> field</dt>
+   <dt>If the line contains a U+003A COLON character (':') character</dt>
 
    <dd>
 
-    <p>This field gives is the interface used for the event, for
-    instance <code>Event</code>, <code>UIEvent</code>,
-    <code>MutationEvent</code>, <code>KeyboardEvent</code>, etc. For
-    compatibility with DOM3 Events, the values <code
-    title="">UIEvents</code>, <code title="">MouseEvents</code>, <code
-    title="">MutationEvents</code>, and <code
-    title="">HTMLEvents</code> are valid values and must be treated
-    respectively as meaning the interfaces <code>UIEvent</code>,
-    <code>MouseEvent</code>, <code>MutationEvent</code>, and
-    <code>Event</code>. (This value can therefore be used as the
-    argument to <code title="">createEvent()</code>.)</p>
-
-    <p>If the value is not specified but the <code
-    title="">Namespace</code> is null and the <code
-    title="">Event</code> field exactly matches one of the events
-    specified by DOM3 Events in <a
-    href="http://www.w3.org/TR/DOM-Level-3-Events/events.html#Events-EventTypes-complete">section
-    1.4.2 "Complete list of event types"</a>, then the interface used
-    must default to the interface relevant for that event type. <a
-    href="#refsDOM3EVENTS">[DOM3EVENTS]</a></p>
-
-    <div class="example">
-     <p>For example:</p>
-     <pre>Event: click</pre>
-     <p>...would cause <code title="">Class</code> to be treated as <code>MouseEvent</code>.</p>
-    </div>
-
-    <p>If the <code title="">Namespace</code> is null and the <code
-    title="">Event</code> field is <code
-    title="event-message">message</code> (including if it was not
-    specified explicitly), then the <code>MessageEvent</code>
-    interface must be used.</p>
+    <p>Collect the characters on the line before the first U+003A
+    COLON character (':'), and let <var title="">field</var> be that
+    string.</p>
 
-    <p>Otherwise, the <code>Event</code> interface must be used.</p>
+    <p>Collect the characters on the line after the first U+003A COLON
+    character (':'), and let <var title="">value</var> be that
+    string. If <var title="">value</var> starts with a single U+0020
+    SPACE character, remove it from <var title="">value</var>.</p>
 
-    <p>It is quite possible to give the wrong class for an event. This
-    is equivalent to creating an event in the DOM using the DOM Event
-    APIs, but using the wrong interface for it.</p>
+    <p><a href="#processField">Process the field</a> using the steps
+    described below, using <var title="">field</var> as the field name
+    and <var title="">value</var> as the field value.</p>
 
    </dd>
 
 
-   <dt><code title="">Bubbles</code> field</dt>
+   <dt>Otherwise, the string is not empty but does not contain a U+003A COLON character (':') character</dt>
 
    <dd>
 
-    <p>This field specifies whether the event is to bubble. If it is
-    specified and has the value <code title="">No</code>, the event
-    must not bubble. If it is specified and has any other value
-    (including <code title="">no</code> or <code title="">NO</code>)
-    then the event must bubble.</p>
-
-    <p>If it is not specified but the <code title="">Namespace</code>
-    field is null and the <code title="">Event</code> field exactly
-    matches one of the events specified by DOM3 Events in <a
-    href="http://www.w3.org/TR/DOM-Level-3-Events/events.html#Events-EventTypes-complete">section
-    1.4.2 "Complete list of event types"</a>, then the event must
-    bubble if the DOM3 Events spec specifies that that event bubbles,
-    and musn't bubble if it specifies it does not.  <a
-    href="#refsDOM3EVENTS">[DOM3EVENTS]</a></p>
+    <p><a href="#processField">Process the field</a> using the steps
+    described below, using the the whole line as the field name, and
+    the empty string as the field value.</p>
 
-    <div class="example">
-     <p>For example:</p>
-     <pre>Event: load</pre>
-     <p>...would cause <code title="">Bubbles</code> to be treated as <code title="">No</code>.</p>
-    </div>
+   </dd>
 
-    <p>Otherwise, the event must bubble.</p>
+  </dl>
 
-   </dd>
+  <p>Once the end of the file is reached, the user agent must <a
+  href="#dispatchMessage">dispatch the event</a> one final time, as
+  defined below.</p></dd>
 
-   <dt><code title="">Cancelable</code> field</dt>
 
-   <dd>
+  <p id="processField">The steps to <dfn title="">process the
+  field</dfn> given a field name and a field value depend on the field
+  name, as given in the following list. Field names must be compared
+  literally, with no case folding performed.</p>
 
-    <p>This field specifies whether the event can have its default
-    action prevented. If it is specified and has the value <code
-    title="">No</code>, the event must not be cancelable. If it is
-    specified and has any other value (including <code
-    title="">no</code> or <code title="">NO</code>) then the event
-    must be cancelable.</p>
+  <dl class="switch">
 
-    <p>If it is not specified, but the <code title="">Namespace</code>
-    field is null and the <code title="">Event</code> field exactly
-    matches one of the events specified by DOM3 Events in <a
-    href="http://www.w3.org/TR/DOM-Level-3-Events/events.html#Events-EventTypes-complete">section
-    1.4.2 "Complete list of event types"</a>, then the event must be
-    cancelable if the DOM3 Events specification specifies that it is,
-    and must not be cancelable otherwise. <a
-    href="#refsDOM3EVENTS">[DOM3EVENTS]</a></p>
+   <dt>If the field name is "event"</dt>
 
-    <div class="example">
-     <p>For example:</p>
-     <pre>Event: load</pre>
-     <p>...would cause <code title="">Cancelable</code> to be treated as <code title="">No</code>.</p>
-    </div>
+   <dd><p>Set the <var title="">event name</var> buffer the field
+   value. <a href="#refsXMLNS">[XMLNS]</a></p></dd>
 
-    <p>Otherwise, the event must be cancelable.</p>
 
-   </dd>
+   <dt>If the field name is "data"</dt>
 
+   <dd><p>If the <var title="">data</var> buffer is not the empty
+   string, then append a single U+000A LINE FEED character to the <var
+   title="">data</var> buffer. Append the field value to the <var
+   title="">data</var> buffer.</p></dd>
 
-   <dt><code title="">Target</code> field</dt>
 
-   <dd>
+   <dt>If the field name is "id"</dt>
 
-    <p>This field gives the node that the event is to be dispatched
-    on.</p>
+   <dd><p>Set the event stream's <span
+   title="concept-event-stream-last-event-id">last event ID</span> to
+   the field value.</p></dd>
 
-    <p>If the object for which the event source is being processed is
-    not a Node, but the <code title="">Target</code> field is
-    nonetheless specified, then the event must be dropped.</p>
 
-    <p>Otherwise, if field is specified and its value starts with a
-    <code title="">#</code> character, then the remainder of the value
-    represents an ID, and the event must be dispatched on the same
-    node as would be obtained by the <code
-    title="">getElementById()</code> method on the <code
-    title="">ownerDocument</code> of the node whose event source is
-    being processed.</p>
+   <dt>If the field name is "retry"</dt>
 
-    <div class="example">
-     <p>For example,</p>
-     <pre>Target: #test</pre>
-     <p>...would target the element with ID <code title="">test</code>.</p>
-    </div>
+   <dd><p>If the field value consists of only characters in the range
+   U+0030 DIGIT ZERO ('0') U+0039 DIGIT NINE ('9'), then interpret the
+   field value as an integer in base ten, and set the event stream's
+   <span title="concept-event-stream-reconnection-time">reconnection
+   time</span> to that integer. Otherwise, ignore the field.</p></dd>
 
-    <p>Otherwise, if the field is specified and its value is the
-    literal string "<code title="">Document</code>", then the event
-    must be dispatched at the <code title="">ownerDocument</code> of
-    the node whose event source is being processed.</p>
 
-    <p>Otherwise, the field (whether specified or not) is ignored and
-    the event must be dispatched at the object itself.</p>
+   <dt>Otherwise</dt>
 
-   </dd>
+   <dd><p>The field is ignored.</p></dd>
 
   </dl>
 
-  <p>Other fields depend on the interface specified (or possibly
-  implied) by the <code title="">Class</code> field. If the specified
-  interface has an attribute that exactly matches the name of the
-  field, and the value of the field can be converted (using the type
-  conversions defined in ECMAScript) to the type of the attribute,
-  then it must be used. Any attributes (other than the
-  <code>Event</code> interface attributes) that do not have matching
-  fields are initialised to zero, null, false, or the empty
-  string.</p>
 
-  <div class="example">
-   <p>For example:</p>
-   <pre>Event: click
-Class: MouseEvent
-button: 2</pre>
-   <p>...would result in a 'click' event using the
-   <code>MouseEvent</code> interface that has <code>button</code> set
-   to <code title="">2</code> but <code>screenX</code>,
-   <code>screenY</code>, etc, set to 0, false, or null as
-   appropriate.</p>
-  </div>
+  <p id="dispatchEvent">When the user agent is required to <dfn
+  title="">dispatch the event</dfn>, then the user agent must act as follows:
 
-  <p>If a field does not match any of the attributes on the event, it
-  must be ignored.</p>
+  <ol>
 
-  <div class="example">
-   <p>For example:</p>
-   <pre>Event: keypress
-Class: MouseEvent
-keyIdentifier: 0</pre>
-   <p>...would result in a <code>MouseEvent</code> event with its
-   fields all at their default values, with the event name being <code
-   title="">keypress</code>. The <code title="">keyIdentifier</code>
-   field would be ignored. (If the author had not included the <code
-   title="">Class</code> field explicitly, it would have just worked,
-   since the class would have defaulted as described above.)</p>
-  </div>
-
-  <p>Once a blank line or the end of the file is reached, an event of
-  the type and namespace given by the <code title="">Event</code> and
-  <code>Namespace</code> fields respectively must be synthesized and
-  dispatched to the appropriate node as described by the fields
-  above. No event must be dispatched until a blank line has been
-  received or the end of the file reached.</p>
-
-  <p>The event must be dispatched as if using the DOM <code
-  title="">dispatchEvent()</code> method. Thus, if the <code
-  title="">Event</code> field was omitted, leaving the name as the
-  empty string, or if the name had invalid characters, then the
-  dispatching of the event fails.</p>
+   <li><p>If the <var title="">data</var> buffer is an empty string,
+   set the <var title="">data</var> buffer and the <var title="">event
+   name</var> buffer to the empty string and abort these
+   steps.</p></li>
+
+   <li><p>If the <var title="">event name</var> buffer is not the
+   empty string but is also not a valid <a
+   href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>,
+   set the <var title="">data</var> buffer and the <var title="">event
+   name</var> buffer to the empty string and abort these
+   steps.</p></li>
+   
+   <li><p>Otherwise, create an event that uses the
+   <code>MessageEvent</code> interface, with the event name <code
+   title="event-message">message</code>, which does not bubble, is
+   cancelable, and has no default action. The <code
+   title="dom-MessageEvent-data">data</code> attribute must be set to
+   the value of the <var title="">data</var> buffer, the <code
+   title="dom-MessageEvent-origin">origin</code> attribute must be set
+   to the <span>origin</span> of the event stream, and the <code
+   title="dom-MessageEvent-source">source</code> attribute must be set
+   to null.</p></li>
+   
+   <li><p>If the <var title="">event name</var> buffer has a value
+   other than the empty string, change the type of the newly created
+   event to equal the value of the <var title="">event name</var>
+   buffer.</p></li>
+
+   <li><p>Set the <var title="">data</var> buffer and the <var
+   title="">event name</var> buffer to the empty string.</p></li>
+
+   <li><p>Dispatch the newly created event at the
+   <code>RemoteEventTarget</code> object to which the event stream is
+   registered.</p></li>
+
+  </ol>
 
-  <p>Events fired from event sources do not have user-agent default
-  actions.</p>
 
   <div class="example">
 
@@ -33268,10 +33149,10 @@
    <p>...would cause an event <code
    title="event-message">message</code> with the interface
    <code>MessageEvent</code> to be dispatched on the
-   <code>event-source</code> element, which would then bubble up the
-   DOM, and whose <code title="dom-MessageEvent-data">data</code>
-   attribute would contain the string <code>YHOO\n-2\n10</code> (where
-   <code>\n</code> again represents a newline).</p>
+   <code>event-source</code> element, whose <code
+   title="dom-MessageEvent-data">data</code> attribute would contain
+   the string <code>YHOO\n-2\n10</code> (where <code>\n</code>
+   represents a newline).</p>
 
    <p>This could be used as follows:
    <pre>&lt;event-source src="http://stocks.example.com/ticker.php"
@@ -33284,30 +33165,61 @@
 
   <div class="example">
 
-   <p>The following stream contains four blocks and therefore fires
-   four events. The first block has just a comment, and will fire a
-   <code title="event-message">message</code> event with all the
-   fields set to the empty string or null. The second block has two
-   fields with names "load" and "Target" respectively; since there is
-   no "<code title="">load</code>" member on the
-   <code>MessageEvent</code> object that field is ignored, leaving the
-   event as a second <code title="event-message">message</code> event
-   with all the fields set to the empty string or null, but this time
-   the event is targetted at an element with ID "image1". The third
-   block is empty (no lines between two blank lines), and the fourth
-   block has only two comments, so they both yet again fire <code
-   title="event-message">message</code> events with all the fields set
-   to the empty string or null.</p>
+   <p>The following stream contains four blocks. The first block has
+   just a comment, and will fire nothing. The second block has two
+   fields with names "data" and "id" respectively; an event will be
+   fired for this block, with the data "first event", and will then
+   set the last event ID to "1" so that if the connection died between
+   this block and the next, the server would be sent a <code
+   title="">Last-Event-ID</code> header with the value "1". The third
+   block fires an event with data "second event", and also has an "id"
+   field, this time with no value, which resets the last event ID to
+   the empty string (meaning no code title="">Last-Event-ID</code>
+   header will now be sent in the event of a reconnection being
+   attempted). Finally the last block just fires an event with the
+   data "third event". Note that the last block doesn't have to end
+   with a blank line, the end of the stream is enough to trigger the
+   dispatch of the last event.</p>
 
-   <pre>; test
+   <pre>: test stream
 
-load
-Target: #image1
+data: first event
+id: 1
 
+data: second event
+id
+
+data: third event</pre>
+  </div>
+
+  <div class="example">
+
+   <p>The following stream fires just one event:</p>
+
+   <pre>data
+
+data
+data
+
+data:</pre>
+
+   <p>The first and last blocks do nothing, since they do not contain
+   any actual data (the <var title="">data</var> buffer remains at the
+   empty string, and so nothing gets dispatched). The middle block
+   fires an event with the data set to a single newline character.</p>
+  </div>
+
+  <div class="example">
+
+   <p>The following stream fires two identical events:</p>
+
+   <pre>data:test
+
+data:&nbsp;test</pre>
+
+   <p>This is because the space after the colon is ignored if
+   present.</p>
 
-; if any more events follow this block, they will not be affected by
-; the "Target" and "load" fields above.
-</pre>
   </div>
 
 
@@ -33315,7 +33227,7 @@
 
   <p>Legacy proxy servers are known to, in certain cases, drop HTTP
   connections after a short timeout. To protect against such proxy
-  servers, authors can include a comment line (one starting with a ';'
+  servers, authors can include a comment line (one starting with a ':'
   character) every 15 seconds or so.</p>
 
   <p>Authors wishing to relate event source connections to each other
@@ -34288,7 +34200,7 @@
 
     <p>Create an event that uses the <code>MessageEvent</code>
     interface, with the event name <code
-    title="event-message">message</code>, which bubbles, is
+    title="event-message">message</code>, which does not bubble, is
     cancelable, and has no default action. The <code
     title="dom-MessageEvent-data">data</code> attribute must be set to
     the value passed as the <var title="">message</var> argument to
Comment 1 Henri Sivonen 2008-03-03 18:40:03 CET
*** Bug 123 has been marked as a duplicate of this bug. ***
Comment 2 Henri Sivonen 2008-03-05 22:19:32 CET
Not applicable to non-script-running conformance checking of the doc.
Comment 3 Nobody 2009-08-21 10:20:11 CEST
The original summary for this bug was longer than 255 characters, and so it was truncated when Bugzilla was upgraded. The original summary was:

* Made it possible to adjust the reconnection timeout.<br> * Made it so that the client tells the server what the last message it <br>   received was when it reconnects, so as to allow seamless continuation. <br> * Rewrote the implementation processing requirements.<br> * Simplified the event stream format:<br>    - removed the concept of 'commands'<br>    - changed the comment syntax from starting with a ';' to<br>      starting with a ':'<br> * Removed the possibility to control anything of the event other than the <br>   'data' and 'type' of the event.<br> * Restricted the events that can be fired to all use MessageEvent.<br> * Made 'message' events not bubble.<br> * Made the MIME type of the new event stream format be<br>   text/event-stream; removed mention of the old format's type <br>   (application/x-dom-event-stream).