W3C home > Mailing lists > Public > public-html-diffs@w3.org > March 2010

device; hixie: peer-to-peer ideas: make the configuration stuff async and repeatable, and make it possible to give the server object details of some third-party server that does routing or whatnot. (whatwg r4858)

From: poot <cvsmail@w3.org>
Date: Tue, 23 Mar 2010 07:41:14 +0900 (JST)
To: public-html-diffs@w3.org
Message-Id: <20100322224114.D9C222BBF4@toro.w3.mag.keio.ac.jp>
device; hixie: peer-to-peer ideas: make the configuration stuff async
and repeatable, and make it possible to give the server object details
of some third-party server that does routing or whatnot. (whatwg r4858)

http://dev.w3.org/cvsweb/html5/html-device/Overview.html?r1=1.26&r2=1.27&f=h
http://html5.org/tools/web-apps-tracker?from=4857&to=4858

===================================================================
RCS file: /sources/public/html5/html-device/Overview.html,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- Overview.html	5 Mar 2010 22:00:55 -0000	1.26
+++ Overview.html	22 Mar 2010 22:40:55 -0000	1.27
@@ -283,7 +283,7 @@
    <h1>HTML Device</h1>
    <h2 class="no-num no-toc" id="an-addition-to-html">An addition to HTML</h2>
 
-   <h2 class="no-num no-toc" id="editor-s-draft-5-march-2010">Editor's Draft 5 March 2010</h2>
+   <h2 class="no-num no-toc" id="editor-s-draft-22-march-2010">Editor's Draft 22 March 2010</h2>
    <dl><dt>Latest Published Version:</dt>
     <dd><a href="http://www.w3.org/TR/html-device/">http://www.w3.org/TR/html-device/</a></dd>
     <dt>Latest Editor's Draft:</dt>
@@ -362,7 +362,7 @@
   specification's progress along the W3C Recommendation
   track.
 
-  This specification is the 5 March 2010 Editor's Draft.
+  This specification is the 22 March 2010 Editor's Draft.
   </p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- relationship to other work (required) --><p>This specification is part of <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/">a
   larger specification</a> being produced by the <a href="http://www.whatwg.org/">WHATWG</a>.
   <!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST -->
@@ -472,36 +472,97 @@
   <code><a href="#devices">device</a></code> element to allow reviewers to look at it.<pre class="idl">[NoInterfaceObject]
 interface <dfn id="abstractpeer">AbstractPeer</dfn> {
   void sendText(in DOMString text);
-  attribute Function ontext; // receiving
+  attribute <span>Function</span> ontext; // receiving
 
   void sendBitmap(in HTMLImageElement image);
-  attribute Function onbitmap; // receiving
+  attribute <span>Function</span> onbitmap; // receiving
 
   void sendFile(in File file);
-  attribute Function onfile; // receiving
+  attribute <span>Function</span> onfile; // receiving
 
-  attribute Stream localStream; // video/audio to send
-  readonly attribute Stream remoteStream; // video/audio from remote peer
-  attribute Function onstreamchange; // when the remote peer changes whether the video is being sent or not
+  attribute <a href="#stream">Stream</a> localStream; // video/audio to send
+  readonly attribute <a href="#stream">Stream</a> remoteStream; // video/audio from remote peer
+  attribute <span>Function</span> onstreamchange; // when the remote peer changes whether the video is being sent or not
 
-  attribute Function onconnect; // called when the connection is established
-  attribute Function ondisconnect;
+  attribute <span>Function</span> onconnect;
+  attribute <span>Function</span> onerror;
+  attribute <span>Function</span> ondisconnect;
 };
 
-[Constructor]
+[Constructor(in DOMString serverConfiguration)]
 interface <dfn id="peertopeerserver">PeerToPeerServer</dfn> : <a href="#abstractpeer">AbstractPeer</a> {
-  DOMString <span title="dom-PeerToPeerServer-getAddress">getAddress</span>(); // returns a string that encodes all the various ways to connect to this peer
-
-  attribute Function onincoming; // incoming call detected
+  void <span title="dom-PeerToPeerServer-getClientConfiguration">getClientConfiguration</span>(in <a href="#peertopeerconfigurationcallback">PeerToPeerConfigurationCallback</a> callback);
+<!--(doesn't make much sense to not accept it, after going to all the effort of setting it up)
+  attribute <span>Function</span> onincoming; // incoming call detected
   void accept(); // accepts incoming call
   void reject(in optional DOMString message); // explicitly rejects incoming call
-
+-->
   void close(); // disconnects and stops listening
 };
 
-[Constructor(in DOMString address)] // pass it the result of getAddress() from the other peer
+[Constructor]
 interface <dfn id="peertopeerclient">PeerToPeerClient</dfn> : <a href="#abstractpeer">AbstractPeer</a> {
-};</pre><p class="XXX">...<h2 class="no-num" id="references">References</h2><!--REFS--><p>All references are normative unless marked "Non-normative".</p><!-- Dates are only included for standards older than the Web,
+  void <span title="dom-PeerToPeerClient-addConfiguration">addConfiguration</span>(in DOMString configuration);
+  void close(); // disconnects
+};
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id="peertopeerconfigurationcallback">PeerToPeerConfigurationCallback</dfn> {
+  void <span title="dom-PeerToPeerConfigurationCallback-handleEvent">handleEvent</span>(in <a href="#peertopeerserver">PeerToPeerServer</a> server, in DOMString configuration);
+};</pre><p class="XXX">...<div class="XXX">
+
+   <p>This relies on some currently hypothetical other standard to
+   define:</p>
+
+   <ul><li>The format of server configuration strings.
+    <li>The format of client configuration strings.
+    <li>The protocols that servers and clients use to talk to third-party servers mentioned in the server configuration strings.
+    <li>The protocols that servers and clients use to talk to each other.
+   </ul></div><div class="example">
+
+   <p>Server:</p>
+
+   <pre>var serverConfig = ...; // configuration string obtained from server
+// contains details such as the IP address of a server that can speak some
+// protocol to help the client determine its public IP address, route packets
+// if necessary, etc.
+
+var local = new PeerToPeerServer(serverConfig);
+local.getClientConfiguration(function (configuration) {
+  if (configuration != '') {
+    ...; // send configuration to other peer using out-of-band mechanism
+  } else {
+    // we've exhausted our options; wait for connection
+  }
+});</pre>
+
+   <p>Client:</p>
+
+   <pre>var local = new PeerToPeerClient();
+function ... (configuration) {
+  // called whenever we get configuration information out-of-band
+  local.addConfiguration(configuration);
+}</pre>
+
+   <p>Both client and server:</p>
+
+   <pre>local.onconnect = function (event) {
+  // we are connected!
+  local.sendText('Hello');
+  local.localStream = ...; // send video
+  local.onstreamchange = function (event) {
+    // receive video
+    // (videoElement is some &lt;video&gt; element)
+    videoElement.src = local.remoteStream.URL;
+  };
+};</pre>
+
+  </div><p class="warning">To prevent network sniffing from allowing a
+  fourth party to establish a connection to the
+  <code><a href="#peertopeerserver">PeerToPeerServer</a></code> using the information sent out-of-band
+  to the <code><a href="#peertopeerclient">PeerToPeerClient</a></code> and thus spoofing the client,
+  the configuration information should always be transmitted using an
+  encrypted connection.<h2 class="no-num" id="references">References</h2><!--REFS--><p>All references are normative unless marked "Non-normative".</p><!-- Dates are only included for standards older than the Web,
   because the newer ones keep changing. --><dl><dt id="refsFILEAPI">[FILEAPI]</dt>
    <dd><cite><a href="http://dev.w3.org/2006/webapi/FileUpload/publish/FileAPI.html">File
    API</a></cite>, A. Ranganathan. W3C.</dd>
Received on Monday, 22 March 2010 22:41:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 18 December 2010 06:14:18 GMT