W3C home > Mailing lists > Public > public-html-commits@w3.org > October 2011

html5/eventsource Overview.html,1.198,1.199

From: Ian Hickson via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 06 Oct 2011 00:25:35 +0000
To: public-html-commits@w3.org
Message-Id: <E1RBbmJ-0008Dq-F8@lionel-hutz.w3.org>
Update of /sources/public/html5/eventsource
In directory hutz:/tmp/cvs-serv31590

Modified Files:
Log Message:
Briefly show an example of using different event types in EventSource. (whatwg r6645)

Index: Overview.html
RCS file: /sources/public/html5/eventsource/Overview.html,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -d -r1.198 -r1.199
--- Overview.html	4 Oct 2011 23:37:09 -0000	1.198
+++ Overview.html	6 Oct 2011 00:25:33 -0000	1.199
@@ -215,7 +215,7 @@
    <h1>Server-Sent Events</h1>
-   <h2 class="no-num no-toc" id="editor-s-draft-4-october-2011">Editor's Draft 4 October 2011</h2>
+   <h2 class="no-num no-toc" id="editor-s-draft-6-october-2011">Editor's Draft 6 October 2011</h2>
    <dl><dt>Latest Published Version:</dt>
     <dd><a href="http://www.w3.org/TR/eventsource/">http://www.w3.org/TR/eventsource/</a></dd>
     <dt>Latest Editor's Draft:</dt>
@@ -323,7 +323,7 @@
   </dl><p>The W3C <a href="http://www.w3.org/2008/webapps/">Web Applications
   Working Group</a> is the W3C working group responsible for this
   specification's progress along the W3C Recommendation track.
-  This specification is the 4 October 2011 Editor's Draft.
+  This specification is the 6 October 2011 Editor's Draft.
   </p><p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
   February 2004 W3C Patent Policy</a>. W3C maintains a <a href="http://www.w3.org/2004/01/pp-impl/42538/status" rel="disclosure">public list of
   any patent disclosures</a> made in connection with the deliverables
@@ -364,7 +364,20 @@
 data: This is the second message, it
 data: has two lines.
-data: This is the third message.</pre><p>Event streams requests can be redirected using HTTP 301 and 307
+data: This is the third message.</pre><hr><p>Authors can separate events by using different event types. Here
+  is a stream that has two event types, "add" and "remove":<pre>event: add
+data: 73857293
+event: remove
+data: 2153
+event: add
+data: 113411</pre><p>The script to handle such a stream would look like this (where
+  <code title="">addHandler</code> and <code title="">removeHandler</code> are functions that take one argument,
+  the event):<pre>var source = new EventSource('updates.cgi');
+source.addEventListener('add', addHandler, false);
+source.addEventListener('remove', removeHandler, false);</pre><p>The default event type is "message".<hr><p>Event streams requests can be redirected using HTTP 301 and 307
   redirects as with normal HTTP requests. Clients will reconnect if
   the connection is closed; a client can be told to stop reconnecting
   using the HTTP 204 No Content response code.<p>Using this API rather than emulating it using
Received on Thursday, 6 October 2011 00:25:37 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:11:01 UTC