[html5] r4988 - [] (0) There's not really any point talking about separate Client and Server obj [...]

whatwg at whatwg.org whatwg at whatwg.org
Thu Apr 8 17:26:03 PDT 2010


Author: ianh
Date: 2010-04-08 17:26:02 -0700 (Thu, 08 Apr 2010)
New Revision: 4988

Modified:
   complete.html
   index
   source
Log:
[] (0) There's not really any point talking about separate Client and Server objects here. Both will have to send config information back and forth to make the connection work anyway.

Modified: complete.html
===================================================================
--- complete.html	2010-04-08 23:49:08 UTC (rev 4987)
+++ complete.html	2010-04-09 00:26:02 UTC (rev 4988)
@@ -186,7 +186,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 — 8 April 2010</h2>
+    <h2 class="no-num no-toc">Draft Standard — 9 April 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>-->
@@ -46646,7 +46646,8 @@
   <code><a href=#devices>device</a></code> element to allow reviewers to look at it.</p>
 
   <pre class=idl>[NoInterfaceObject]
-interface <dfn id=abstractpeer>AbstractPeer</dfn> {
+[Constructor(in DOMString serverConfiguration)]
+interface <dfn id=connectionpeer>ConnectionPeer</dfn> {
   void sendText(in DOMString text);
   attribute <a href=#function>Function</a> ontext; // receiving
 
@@ -46656,35 +46657,24 @@
   void sendFile(in File file);
   attribute <a href=#function>Function</a> onfile; // receiving
 
-  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
+  void addStream(in Stream stream);
+  void removeStream(in Stream stream);
+  readonly attribute Stream[] localStreams;
+  readonly attribute Stream[] remoteStreams;
+  attribute <a href=#function>Function</a> onstream; // receiving
 
+  void <span title=dom-ConnectionPeer-getLocalConfiguration>getLocalConfiguration</span>(in <a href=#connectionpeerconfigurationcallback>ConnectionPeerConfigurationCallback</a> callback); // maybe this should be in the constructor
+  void <span title=dom-ConnectionPeer-addRemoteConfiguration>addRemoteConfiguration</span>(in DOMString configuration);
+  void close(); // disconnects and stops listening
+
   attribute <a href=#function>Function</a> onconnect;
   attribute <a href=#function>Function</a> onerror;
   attribute <a href=#function>Function</a> ondisconnect;
 };
 
-[Constructor(in DOMString serverConfiguration)]
-interface <dfn id=peertopeerserver>PeerToPeerServer</dfn> : <a href=#abstractpeer>AbstractPeer</a> {
-  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]
-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);
+interface <dfn id=connectionpeerconfigurationcallback>ConnectionPeerConfigurationCallback</dfn> {
+  void <span title=dom-ConnectionPeerConfigurationCallback-handleEvent>handleEvent</span>(in <a href=#connectionpeer>ConnectionPeer</a> server, in DOMString configuration);
 };</pre>
 
   <p class=XXX>...</p>
@@ -46696,57 +46686,58 @@
 
    <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.
+    <li>The protocols that clients use to talk to third-party servers mentioned in the server configuration strings.
+    <li>The protocols that clients use to talk to each other.
    </ul></div>
 
   <div class=example>
 
-   <p>Server:</p>
+   <p>When two peers decide they are going to set up a connection to
+   each other, they both go through these steps. The serverConfig
+   comes from a third-party server they can use to get things like
+   their public IP address or to set up NAT traversal. They also have
+   to send their respective configuration to each other using the same
+   out-of-band mechanism they used to establish that they were going
+   to communicate in the first place.</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) {
+var local = new ConnectionPeer(serverConfig);
+local.getLocalConfiguration(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>
+  local.addRemoteConfiguration(configuration);
+}
 
-   <p>Both client and server:</p>
-
-   <pre>local.onconnect = function (event) {
+local.onconnect = function (event) {
   // we are connected!
   local.sendText('Hello');
-  local.localStream = ...; // send video
-  local.onstreamchange = function (event) {
+  local.addStream(...); // send video
+  local.onstream = function (event) {
     // receive video
     // (videoElement is some <video> element)
-    videoElement.src = local.remoteStream.URL;
+    if (local.remoteStreams.length > 0)
+      videoElement.src = local.remoteStreams[0].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>
+  fourth party to establish a connection to a peer using the
+  information sent out-of-band to the other peer and thus spoofing the
+  client, the configuration information should always be transmitted
+  using an encrypted connection.</p>
 
 
 

Modified: index
===================================================================
--- index	2010-04-08 23:49:08 UTC (rev 4987)
+++ index	2010-04-09 00:26:02 UTC (rev 4988)
@@ -190,7 +190,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 — 8 April 2010</h2>
+    <h2 class="no-num no-toc">Draft Standard — 9 April 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>-->
@@ -46547,7 +46547,8 @@
   <code><a href=#devices>device</a></code> element to allow reviewers to look at it.</p>
 
   <pre class=idl>[NoInterfaceObject]
-interface <dfn id=abstractpeer>AbstractPeer</dfn> {
+[Constructor(in DOMString serverConfiguration)]
+interface <dfn id=connectionpeer>ConnectionPeer</dfn> {
   void sendText(in DOMString text);
   attribute <a href=#function>Function</a> ontext; // receiving
 
@@ -46557,35 +46558,24 @@
   void sendFile(in File file);
   attribute <a href=#function>Function</a> onfile; // receiving
 
-  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
+  void addStream(in Stream stream);
+  void removeStream(in Stream stream);
+  readonly attribute Stream[] localStreams;
+  readonly attribute Stream[] remoteStreams;
+  attribute <a href=#function>Function</a> onstream; // receiving
 
+  void <span title=dom-ConnectionPeer-getLocalConfiguration>getLocalConfiguration</span>(in <a href=#connectionpeerconfigurationcallback>ConnectionPeerConfigurationCallback</a> callback); // maybe this should be in the constructor
+  void <span title=dom-ConnectionPeer-addRemoteConfiguration>addRemoteConfiguration</span>(in DOMString configuration);
+  void close(); // disconnects and stops listening
+
   attribute <a href=#function>Function</a> onconnect;
   attribute <a href=#function>Function</a> onerror;
   attribute <a href=#function>Function</a> ondisconnect;
 };
 
-[Constructor(in DOMString serverConfiguration)]
-interface <dfn id=peertopeerserver>PeerToPeerServer</dfn> : <a href=#abstractpeer>AbstractPeer</a> {
-  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]
-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);
+interface <dfn id=connectionpeerconfigurationcallback>ConnectionPeerConfigurationCallback</dfn> {
+  void <span title=dom-ConnectionPeerConfigurationCallback-handleEvent>handleEvent</span>(in <a href=#connectionpeer>ConnectionPeer</a> server, in DOMString configuration);
 };</pre>
 
   <p class=XXX>...</p>
@@ -46597,57 +46587,58 @@
 
    <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.
+    <li>The protocols that clients use to talk to third-party servers mentioned in the server configuration strings.
+    <li>The protocols that clients use to talk to each other.
    </ul></div>
 
   <div class=example>
 
-   <p>Server:</p>
+   <p>When two peers decide they are going to set up a connection to
+   each other, they both go through these steps. The serverConfig
+   comes from a third-party server they can use to get things like
+   their public IP address or to set up NAT traversal. They also have
+   to send their respective configuration to each other using the same
+   out-of-band mechanism they used to establish that they were going
+   to communicate in the first place.</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) {
+var local = new ConnectionPeer(serverConfig);
+local.getLocalConfiguration(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>
+  local.addRemoteConfiguration(configuration);
+}
 
-   <p>Both client and server:</p>
-
-   <pre>local.onconnect = function (event) {
+local.onconnect = function (event) {
   // we are connected!
   local.sendText('Hello');
-  local.localStream = ...; // send video
-  local.onstreamchange = function (event) {
+  local.addStream(...); // send video
+  local.onstream = function (event) {
     // receive video
     // (videoElement is some <video> element)
-    videoElement.src = local.remoteStream.URL;
+    if (local.remoteStreams.length > 0)
+      videoElement.src = local.remoteStreams[0].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>
+  fourth party to establish a connection to a peer using the
+  information sent out-of-band to the other peer and thus spoofing the
+  client, the configuration information should always be transmitted
+  using an encrypted connection.</p>
 
 
 

Modified: source
===================================================================
--- source	2010-04-08 23:49:08 UTC (rev 4987)
+++ source	2010-04-09 00:26:02 UTC (rev 4988)
@@ -51871,7 +51871,8 @@
   <code>device</code> element to allow reviewers to look at it.</p>
 
   <pre class="idl">[NoInterfaceObject]
-interface <dfn>AbstractPeer</dfn> {
+[Constructor(in DOMString serverConfiguration)]
+interface <dfn>ConnectionPeer</dfn> {
   void sendText(in DOMString text);
   attribute <span>Function</span> ontext; // receiving
 
@@ -51881,35 +51882,24 @@
   void sendFile(in File file);
   attribute <span>Function</span> onfile; // receiving
 
-  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
+  void addStream(in Stream stream);
+  void removeStream(in Stream stream);
+  readonly attribute Stream[] localStreams;
+  readonly attribute Stream[] remoteStreams;
+  attribute <span>Function</span> onstream; // receiving
 
+  void <span title="dom-ConnectionPeer-getLocalConfiguration">getLocalConfiguration</span>(in <span>ConnectionPeerConfigurationCallback</span> callback); // maybe this should be in the constructor
+  void <span title="dom-ConnectionPeer-addRemoteConfiguration">addRemoteConfiguration</span>(in DOMString configuration);
+  void close(); // disconnects and stops listening
+
   attribute <span>Function</span> onconnect;
   attribute <span>Function</span> onerror;
   attribute <span>Function</span> ondisconnect;
 };
 
-[Constructor(in DOMString serverConfiguration)]
-interface <dfn>PeerToPeerServer</dfn> : <span>AbstractPeer</span> {
-  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]
-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);
+interface <dfn>ConnectionPeerConfigurationCallback</dfn> {
+  void <span title="dom-ConnectionPeerConfigurationCallback-handleEvent">handleEvent</span>(in <span>ConnectionPeer</span> server, in DOMString configuration);
 };</pre>
 
   <p class="XXX">...</p>
@@ -51922,59 +51912,60 @@
    <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.
+    <li>The protocols that clients use to talk to third-party servers mentioned in the server configuration strings.
+    <li>The protocols that clients use to talk to each other.
    </ul>
 
   </div>
 
   <div class="example">
 
-   <p>Server:</p>
+   <p>When two peers decide they are going to set up a connection to
+   each other, they both go through these steps. The serverConfig
+   comes from a third-party server they can use to get things like
+   their public IP address or to set up NAT traversal. They also have
+   to send their respective configuration to each other using the same
+   out-of-band mechanism they used to establish that they were going
+   to communicate in the first place.</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) {
+var local = new ConnectionPeer(serverConfig);
+local.getLocalConfiguration(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>
+  local.addRemoteConfiguration(configuration);
+}
 
-   <p>Both client and server:</p>
-
-   <pre>local.onconnect = function (event) {
+local.onconnect = function (event) {
   // we are connected!
   local.sendText('Hello');
-  local.localStream = ...; // send video
-  local.onstreamchange = function (event) {
+  local.addStream(...); // send video
+  local.onstream = function (event) {
     // receive video
     // (videoElement is some <video> element)
-    videoElement.src = local.remoteStream.URL;
+    if (local.remoteStreams.length > 0)
+      videoElement.src = local.remoteStreams[0].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>
+  fourth party to establish a connection to a peer using the
+  information sent out-of-band to the other peer 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