[html5] r4858 - [] (0) peer-to-peer ideas: make the configuration stuff async and repeatable, an [...]

whatwg at whatwg.org whatwg at whatwg.org
Mon Mar 22 15:40:53 PDT 2010


Author: ianh
Date: 2010-03-22 15:40:51 -0700 (Mon, 22 Mar 2010)
New Revision: 4858

Modified:
   complete.html
   index
   source
Log:
[] (0) 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.

Modified: complete.html
===================================================================
--- complete.html	2010-03-17 23:50:31 UTC (rev 4857)
+++ complete.html	2010-03-22 22:40:51 UTC (rev 4858)
@@ -157,7 +157,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
    <hgroup><h1>Web Applications 1.0</h1>
-    <h2 class="no-num no-toc">Draft Standard — 17 March 2010</h2>
+    <h2 class="no-num no-toc">Draft Standard — 22 March 2010</h2>
    </hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -45387,44 +45387,111 @@
   <pre class=idl>[NoInterfaceObject]
 interface <dfn id=abstractpeer>AbstractPeer</dfn> {
   void sendText(in DOMString text);
-  attribute Function ontext; // receiving
+  attribute <a href=#function>Function</a> ontext; // receiving
 
   void sendBitmap(in HTMLImageElement image);
-  attribute Function onbitmap; // receiving
+  attribute <a href=#function>Function</a> onbitmap; // receiving
 
   void sendFile(in File file);
-  attribute Function onfile; // receiving
+  attribute <a href=#function>Function</a> 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 <a href=#function>Function</a> 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 <a href=#function>Function</a> onconnect;
+  attribute <a href=#function>Function</a> onerror;
+  attribute <a href=#function>Function</a> 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> {
+  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>...</p>
 
+  <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 <video> 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.</p>
+
+
+
+
+
+
   <h3 id=links><span class=secno>4.12 </span>Links</h3>
 
 

Modified: index
===================================================================
--- index	2010-03-17 23:50:31 UTC (rev 4857)
+++ index	2010-03-22 22:40:51 UTC (rev 4858)
@@ -161,7 +161,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
    <hgroup><h1>HTML5 (including next generation additions still in development)</h1>
-    <h2 class="no-num no-toc">Draft Standard — 17 March 2010</h2>
+    <h2 class="no-num no-toc">Draft Standard — 22 March 2010</h2>
    </hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -45289,44 +45289,111 @@
   <pre class=idl>[NoInterfaceObject]
 interface <dfn id=abstractpeer>AbstractPeer</dfn> {
   void sendText(in DOMString text);
-  attribute Function ontext; // receiving
+  attribute <a href=#function>Function</a> ontext; // receiving
 
   void sendBitmap(in HTMLImageElement image);
-  attribute Function onbitmap; // receiving
+  attribute <a href=#function>Function</a> onbitmap; // receiving
 
   void sendFile(in File file);
-  attribute Function onfile; // receiving
+  attribute <a href=#function>Function</a> 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 <a href=#function>Function</a> 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 <a href=#function>Function</a> onconnect;
+  attribute <a href=#function>Function</a> onerror;
+  attribute <a href=#function>Function</a> 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> {
+  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>...</p>
 
+  <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 <video> 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.</p>
+
+
+
+
+
+
   <h3 id=links><span class=secno>4.12 </span>Links</h3>
 
 

Modified: source
===================================================================
--- source	2010-03-17 23:50:31 UTC (rev 4857)
+++ source	2010-03-22 22:40:51 UTC (rev 4858)
@@ -50493,39 +50493,109 @@
   <pre class="idl">[NoInterfaceObject]
 interface <dfn>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 <span>Stream</span> localStream; // video/audio to send
+  readonly attribute <span>Stream</span> 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>PeerToPeerServer</dfn> : <span>AbstractPeer</span> {
-  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 <span>PeerToPeerConfigurationCallback</span> 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>PeerToPeerClient</dfn> : <span>AbstractPeer</span> {
+  void <span title="dom-PeerToPeerClient-addConfiguration">addConfiguration</span>(in DOMString configuration);
+  void close(); // disconnects
+};
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn>PeerToPeerConfigurationCallback</dfn> {
+  void <span title="dom-PeerToPeerConfigurationCallback-handleEvent">handleEvent</span>(in <span>PeerToPeerServer</span> server, in DOMString configuration);
 };</pre>
 
   <p class="XXX">...</p>
 
+  <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 <video> 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>PeerToPeerServer</code> using the information sent out-of-band
+  to the <code>PeerToPeerClient</code> and thus spoofing the client,
+  the configuration information should always be transmitted using an
+  encrypted connection.</p>
+
 <!--END html-device--><!--START w3c-html-->
 
 




More information about the Commit-Watchers mailing list