Browse Source

refactoring docs

afrokick 6 years ago
parent
commit
85802427b3
9 changed files with 396 additions and 303 deletions
  1. 47 33
      docs/api.json
  2. 1 1
      docs/api.md
  3. 0 0
      docs/css/docs.css
  4. 156 120
      docs/index.html
  5. 17 15
      docs/js/docs.js
  6. 3 0
      docs/js/jquery.min.js
  7. 7 3
      docs/package.json
  8. 1 3
      docs/readme.md
  9. 164 128
      docs/template.html

+ 47 - 33
docs/api.json

@@ -9,7 +9,7 @@
         "name": "id",
         "optional": true,
         "type": "string",
-        "description": "Other peers can connect to this peer using the provided ID. If no ID is given, one will be generated by the brokering server. The ID must start and end with an alphanumeric character (lower or upper case character or a digit). In the middle of the ID spaces, dashes (-) and underscores (_) are allowed.<span class='warn'>It's not recommended that you use this ID to identify peers, as it's meant to be used for brokering connections only. You're recommended to set the <a href='#peerconnect-options'><code>metadata</code></a> option to send other identifying information.</span>"
+        "description": "Other peers can connect to this peer using the provided ID. If no ID is given, one will be generated by the brokering server. <span class='warn'>It's not recommended that you use this ID to identify peers, as it's meant to be used for brokering connections only. You're recommended to set the <a href='#peerconnect-options'><code>metadata</code></a> option to send other identifying information.</span>"
       },
       {
         "name": "options",
@@ -29,7 +29,7 @@
           {
             "name": "port",
             "type": "number",
-            "description": "Server port. Defaults to <code>9000</code>."
+            "description": "Server port. Defaults to <code>443</code>."
           },
           {
             "name": "path",
@@ -39,18 +39,22 @@
           {
             "name": "secure",
             "type": "boolean",
-            "tags": ["beta (0.3.0)"],
+            "tags": [
+              "beta (0.3.0)"
+            ],
             "description": "<code>true</code> if you're using SSL.<span class='tip'>Note that our cloud-hosted server and assets may not support SSL.</span>"
           },
           {
             "name": "config",
             "type": "object",
-            "description": "Configuration hash passed to RTCPeerConnection. This hash contains any custom ICE/TURN server configuration. Defaults to <code>{ 'iceServers': [{ 'url': 'stun:stun.l.google.com:19302' }] }</code>"
+            "description": "Configuration hash passed to RTCPeerConnection. This hash contains any custom ICE/TURN server configuration. Defaults to <code>{ 'iceServers': [{ 'urls': 'stun:stun.l.google.com:19302' }], 'sdpSemantics': 'unified-plan' }</code>"
           },
           {
             "name": "debug",
             "type": "number",
-            "tags": ["beta (0.3.0)"],
+            "tags": [
+              "beta (0.3.0)"
+            ],
             "description": "Prints log messages depending on the debug level passed in. Defaults to <code>0</code>.",
             "children": [
               {
@@ -75,7 +79,6 @@
       }
     ]
   },
-
   {
     "name": "peer.connect",
     "type": "method",
@@ -115,10 +118,11 @@
       }
     ]
   },
-
   {
     "name": "peer.call",
-    "tags": ["beta (0.3.0)"],
+    "tags": [
+      "beta (0.3.0)"
+    ],
     "type": "method",
     "snippet": "var <a href='#mediaconnection'>mediaConnection</a> = peer.call(id, stream, [options]);",
     "description": "Calls the remote peer specified by <code>id</code> and returns a media connection. Be sure to listen on the <a href='#peeron-error'><code>error</code></a> event in case the connection fails.",
@@ -146,7 +150,6 @@
       }
     ]
   },
-
   {
     "name": "peer.on",
     "type": "method",
@@ -168,7 +171,9 @@
       {
         "name": "'call'",
         "type": "event",
-        "tags": ["beta (0.3.0)"],
+        "tags": [
+          "beta (0.3.0)"
+        ],
         "snippet": "peer.on('call', function(<a href='#mediaconnection'>mediaConnection</a>) { ... });",
         "description": "Emitted when a remote peer attempts to call you. The emitted <code>mediaConnection</code> is not yet active; you must first answer the call (<a href='#mediaconnection-answer'><code>mediaConnection.answer([stream]);</code></a>). Then, you can listen for the <a href='#mediaconnection-on'><code>stream</code></a> event."
       },
@@ -193,7 +198,9 @@
           {
             "name": "'browser-incompatible'",
             "type": "Error",
-            "tags": ["fatal"],
+            "tags": [
+              "fatal"
+            ],
             "description": "The client's browser does not support some or all WebRTC features that you are trying to use."
           },
           {
@@ -204,13 +211,17 @@
           {
             "name": "'invalid-id'",
             "type": "Error",
-            "tags": ["fatal"],
+            "tags": [
+              "fatal"
+            ],
             "description": "The ID passed into the Peer constructor contains illegal characters."
           },
           {
             "name": "'invalid-key'",
             "type": "Error",
-            "tags": ["fatal"],
+            "tags": [
+              "fatal"
+            ],
             "description": "The API key passed into the Peer constructor contains illegal characters or is not in the system (cloud server only)."
           },
           {
@@ -226,31 +237,41 @@
           {
             "name": "'ssl-unavailable'",
             "type": "Error",
-            "tags": ["fatal"],
+            "tags": [
+              "fatal"
+            ],
             "description": "PeerJS is being used securely, but the cloud server does not support SSL. Use a custom PeerServer."
           },
           {
             "name": "'server-error'",
             "type": "Error",
-            "tags": ["fatal"],
+            "tags": [
+              "fatal"
+            ],
             "description": "Unable to reach the server."
           },
           {
             "name": "'socket-error'",
             "type": "Error",
-            "tags": ["fatal"],
+            "tags": [
+              "fatal"
+            ],
             "description": "An error from the underlying socket."
           },
           {
             "name": "'socket-closed'",
             "type": "Error",
-            "tags": ["fatal"],
+            "tags": [
+              "fatal"
+            ],
             "description": "The underlying socket closed unexpectedly."
           },
           {
             "name": "'unavailable-id'",
             "type": "Error",
-            "tags": ["sometimes fatal"],
+            "tags": [
+              "sometimes fatal"
+            ],
             "description": "The ID passed into the Peer constructor is already taken.<span class='warn'>This error is not fatal if your peer has open peer-to-peer connections. This can happen if you attempt to <a href='#peerreconnect'>reconnect</a> a peer that has been <a href='#peerdisconnect'>disconnected from the server</a>, but its old ID has now been taken.</span>"
           },
           {
@@ -262,53 +283,44 @@
       }
     ]
   },
-
   {
     "name": "peer.disconnect",
     "type": "method",
     "snippet": "peer.disconnect();",
     "description": "Close the connection to the server, leaving all existing data and media connections intact. <a href='#peerdisconnected'><code>peer.disconnected</code></a> will be set to <code>true</code> and the <a href='#peeron-disconnected'><code>disconnected</code></a> event will fire.<span class='warn'>This cannot be undone; the respective peer object will no longer be able to create or receive any connections and its ID will be forfeited on the (cloud) server.</span>"
   },
-
   {
     "name": "peer.reconnect",
     "type": "method",
     "snippet": "peer.reconnect();",
     "description": "Attempt to reconnect to the server with the peer's old ID. Only <a href='#peerdisconnect'>disconnected peers</a> can be reconnected. Destroyed peers cannot be reconnected. If the connection fails (as an example, if the peer's old ID is now taken), the peer's existing connections will not close, but any associated errors events will fire."
   },
-
-
   {
     "name": "peer.destroy",
     "type": "method",
     "snippet": "peer.destroy();",
     "description": "Close the connection to the server and terminate all existing connections. <a href='#peerdestroyed'><code>peer.destroyed</code></a> will be set to <code>true</code>.<span class='warn'>This cannot be undone; the respective peer object will no longer be able to create or receive any connections, its ID will be forfeited on the (cloud) server, and all of its data and media connections will be closed.</span>"
   },
-
   {
     "name": "peer.id",
     "type": "string",
     "description": "The brokering ID of this peer. If no ID was specified in <a href='#peer'>the constructor</a>, this will be <code>undefined</code> until the <a href='#peeron-open'><code>open</code></a> event is emitted."
   },
-
   {
     "name": "peer.connections",
     "type": "object",
     "description": "A hash of all connections associated with this peer, keyed by the remote peer's ID.<span class='tip'>We recommend keeping track of connections yourself rather than relying on this hash.</span>"
   },
-
   {
     "name": "peer.disconnected",
     "type": "boolean",
     "description": "<code>false</code> if there is an active connection to the PeerServer."
   },
-
   {
     "name": "peer.destroyed",
     "type": "boolean",
     "description": "<code>true</code> if this peer and all of its connections can no longer be used."
   },
-
   {
     "name": "DataConnection",
     "type": "class",
@@ -412,11 +424,12 @@
       }
     ]
   },
-
   {
     "name": "MediaConnection",
     "type": "class",
-    "tags": ["beta (0.3.0)"],
+    "tags": [
+      "beta (0.3.0)"
+    ],
     "description": "Wraps WebRTC's media streams. To get one, use <a href='#peercall'><code>peer.call</code></a> or listen for the <a href='#peeron-call'><code>call</code></a> event.",
     "children": [
       {
@@ -453,7 +466,7 @@
             "name": "'close'",
             "type": "event",
             "snippet": "mediaConnection.on('close', function() { ... });",
-            "description": "Emitted when either you or the remote peer closes the media connection.<span class='warn'>Firefox does not yet support this event.</span>"
+            "description": "Emitted when either you or the remote peer closes the media connection. <span class='warn'>Firefox does not yet support this event.</span>"
           },
           {
             "name": "'error'",
@@ -483,11 +496,12 @@
       }
     ]
   },
-
   {
     "name": "util",
     "type": "object",
-    "tags": ["utility"],
+    "tags": [
+      "utility"
+    ],
     "description": "Provides a variety of helpful utilities.<span class='warn'>Only the utilities documented here are guaranteed to be present on <code>util</code>. Undocumented utilities can be removed without warning. We don't consider these to be 'breaking changes.'</span>",
     "children": [
       {
@@ -526,4 +540,4 @@
       }
     ]
   }
-]
+]

+ 1 - 1
docs/api.md

@@ -1,4 +1,4 @@
 # PeerJS API Reference
 
-We've moved! <a href="http://peerjs.com/docs#api">Check out our new API
+We've moved! <a href="https://peerjs.com/docs#api">Check out our new API
 reference.</a>

+ 0 - 0
docs/style.css → docs/css/docs.css


File diff suppressed because it is too large
+ 156 - 120
docs/index.html


+ 17 - 15
docs/index.js → docs/js/docs.js

@@ -1,16 +1,17 @@
-/* global $ */
-$(document).ready(function () {
-  const $api = $('.api');
-  const $start = $('.start');
-  const $show = $('.left .show');
-  const $hide = $('.left .hide');
-  let width = $(window).width();
-  const THRESHOLD = 700;
+$(document).ready(function() {
+  var $api = $('.api');
+  var $start = $('.start');
+  var $show = $('.left .show');
+  var $hide = $('.left .hide');
+  var width = $(window).width();
+  var height = $(window).height();
+  var THRESHOLD = 700;
 
   init();
 
-  $(window).on('resize', function () {
+  $(window).on('resize', function() {
     width = $(window).width();
+    height = $(window).height();
 
     init();
   });
@@ -20,7 +21,8 @@ $(document).ready(function () {
     hideAPI();
   }
 
-  function init () {
+
+  function init() {
     if (width < THRESHOLD) {
       $api.addClass('fullscreen');
       $start.addClass('full');
@@ -40,7 +42,7 @@ $(document).ready(function () {
     }
   }
 
-  function hideAPI () {
+  function hideAPI() {
     $api.addClass('hidden');
     if (width >= THRESHOLD) {
       $start.addClass('full');
@@ -49,7 +51,7 @@ $(document).ready(function () {
     }
   }
 
-  function showAPI () {
+  function showAPI() {
     if (width >= THRESHOLD) {
       $start.removeClass('full');
       $show.hide();
@@ -58,7 +60,7 @@ $(document).ready(function () {
     $api.removeClass('hidden');
   }
 
-  $('body').on('click', '.left', function () {
+  $('body').on('click', '.left', function() {
     if ($api.attr('class').indexOf('hidden') !== -1) {
       showAPI();
     } else if ($api.attr('class').indexOf('fullscreen') === -1) {
@@ -66,10 +68,10 @@ $(document).ready(function () {
       hideAPI();
     }
   });
-  $('body').on('click', '.right', function () {
+  $('body').on('click', '.right', function() {
     hideAPI();
   });
-  $('body').on('click', 'a', function () {
+  $('body').on('click', 'a', function() {
     if ($(this).attr('href').indexOf('#') === 0) {
       showAPI();
     }

File diff suppressed because it is too large
+ 3 - 0
docs/js/jquery.min.js


+ 7 - 3
docs/package.json

@@ -2,16 +2,20 @@
   "name": "docs",
   "version": "0.0.0",
   "description": "**Due to browsers' incomplete support of the WebRTC DataChannel specification, many features of PeerJS have caveats.\r [View the status page for full details](http://peerjs.com/status).**",
-  "main": "index.js",
+  "main": "build.js",
   "scripts": {
-    "test": "echo \"Error: no test specified\" && exit 1"
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "build": "node build.js"
   },
   "repository": "",
   "author": "",
   "license": "BSD",
   "readmeFilename": "readme.md",
   "dependencies": {
-    "reference": ">0.0.0",
+    "reference": "^0.1.1",
     "handlebars": ">=4.0.0"
+  },
+  "devDependencies": {
+    "standard": "^12.0.1"
   }
 }

+ 1 - 3
docs/readme.md

@@ -1,8 +1,6 @@
 ## PeerJS Documentation
 
-We've moved! <a href="http://peerjs.com/docs">Check out our new
+We've moved! <a href="https://peerjs.com/docs">Check out our new
 documentation.</a>
 
-###[Browser compatibility and limitations](http://peerjs.com/status)
-
 ### [Discuss PeerJS on our Google Group](https://groups.google.com/forum/?fromgroups#!forum/peerjs)

+ 164 - 128
docs/template.html

@@ -1,65 +1,79 @@
 <head>
   <title>PeerJS Documentation</title>
   <meta name="viewport" content="width=device-width, maximum-scale=1">
-  <link href='http://fonts.googleapis.com/css?family=Lato:300,400,700,900' rel='stylesheet' type='text/css'>
-  <link href="./style.css" rel="stylesheet" type="text/css">
-  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
-  <script type="text/javascript" src="./index.js"></script>
+  <link href='https://fonts.googleapis.com/css?family=Lato:300,400,700,900' rel='stylesheet' type='text/css'>
+  <link href="/css/docs.css" rel="stylesheet" type="text/css">
+  <script type="text/javascript" src="/js/jquery.min.js"></script>
+  <script type="text/javascript" src="/js/docs.js"></script>
 </head>
 
 <body>
   <section class="start">
-    <h1><a href="/">PeerJS</a> <span class="title">docs</span></h1>
-    <p><br>PeerJS simplifies peer-to-peer data, video, and audio calls.</p>
-      <p>This guide will show you the basic concepts of the PeerJS API. If
-      you learn better from seeing a working app, <a href="/examples">see the examples</a> page.</P>
-      <h2>Setup</h2>
-      <h3>1. Include the Javascript client</h3>
-      <p>Add the PeerJS client library to your webpage.</p>
-      <pre>&lt;script src="http://cdn.peerjs.com/0.3/peer.min.js"&gt;&lt;/script&gt;</pre>
-      <p>If you prefer, you can host it yourself: <a download
-        href="http://cdn.peerjs.com/0.3/peer.js">peer.js</a>, <a download
-      href="http://cdn.peerjs.com/0.3/peer.min.js">peer.min.js</a>, or <a
-      href="https://github.com/peers/peerjs">fork us on Github</a>.</p>
-      <h3>2. Create the Peer object</h3>
-      <p>The Peer object is where we create and receive connections.</p>
-      <pre>var peer = new Peer({key: 'lwjd5qra8257b9'});</pre>
-      <p>The 'key' we're passing in to the Peer constructor is a PeerServer
-      cloud API key. You can use ours for now, but you should <a
-      href="http://peerjs.com/peerserver">sign up for your own free key</a>.
-    PeerJS uses PeerServer for session metadata and candidate signaling. You can
-    also <a href="http://github.com/peers/peerjs-server">run your own PeerServer</a> if you don't like the cloud.</p>
-      <p>We're now ready to start making connections!</p>
-
-      <h2>Usage</h2>
-      <p>Every Peer object is assigned a random, unique ID when it's created.</p>
-      <pre>peer.on('open', function(id) {
+    <h1>
+      <a href="/">PeerJS</a>
+      <span class="title">docs</span>
+    </h1>
+    <p>
+      <br>PeerJS simplifies peer-to-peer data, video, and audio calls.</p>
+    <p>This guide will show you the basic concepts of the PeerJS API. If you learn better from seeing a working app,
+      <a href="/examples">see the examples</a> page.</P>
+    <h2>Setup</h2>
+    <h3>1. Include the Javascript client</h3>
+    <p>Add the PeerJS client library to your webpage.</p>
+    <pre>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/peerjs/0.3.9/peer.min.js"&gt;&lt;/script&gt;</pre>
+    <p>If you prefer, you can host it yourself:
+      <a download href="https://cdnjs.cloudflare.com/ajax/libs/peerjs/0.3.9/peer.min.js">peer.min.js</a>, or
+      <a href="https://github.com/peers/peerjs">fork us on Github</a>.</p>
+    <h3>2. Create the Peer object</h3>
+    <p>The Peer object is where we create and receive connections.</p>
+    <pre>var peer = new Peer({key: 'lwjd5qra8257b9'});</pre>
+    <p>The 'key' we're passing in to the Peer constructor is a PeerServer cloud API key. You can use ours for now, but
+      you should
+      <a href="https://peerjs.com/peerserver">sign up for your own free key</a>. PeerJS uses PeerServer for session
+      metadata and candidate signaling. You can also
+      <a href="https://github.com/peers/peerjs-server">run your own PeerServer</a> if you don't like the cloud.</p>
+    <p>We're now ready to start making connections!</p>
+
+    <h2>Usage</h2>
+    <p>Every Peer object is assigned a random, unique ID when it's created.</p>
+    <pre>peer.on('open', function(id) {
   console.log('My peer ID is: ' + id);
 });</pre>
-      <p>When we want to connect to another peer, we'll need to know their peer
-      id. You're in charge of communicating the peer IDs between users of your
-      site. Optionally, you can pass in your own IDs to the <a href="#peer"><code>Peer</code>
-        constructor</a>.</p>
-
-      <p>Read the <a href="#peer">Peer API reference</a> for complete
-      information on its <a href="#peer-options">options</a>, methods, <a href="#peeron">events</a>, and <a
-        href="#peeron-error">error handling</a>.</p>
-
-      <h3>Data connections</h3>
-      <p>Start a data connection by calling <code>peer.connect</code> with the peer ID of the
-      destination peer. Anytime another peer attempts to connect to your peer
-      ID, you'll receive a <code>connection</code> event. </p>
-      <div class="two-col">
-        <div class="col col-header">Start connection</div>
-        <div class="col col-header">Receive connection</div>
-        <div class="col"><pre>var conn = peer.connect('dest-peer-id');</pre></div>
-        <div class="col"><pre>peer.on('connection', function(conn) { ... });</pre></div>
-        <div class="clear"></div>
+    <p>When we want to connect to another peer, we'll need to know their peer id. You're in charge of communicating the
+      peer
+      IDs between users of your site. Optionally, you can pass in your own IDs to the
+      <a href="#peer">
+        <code>Peer</code> constructor
+      </a>.</p>
+
+    <p>Read the
+      <a href="#peer">Peer API reference</a> for complete information on its
+      <a href="#peer-options">options</a>, methods,
+      <a href="#peeron">events</a>, and
+      <a href="#peeron-error">error handling</a>.</p>
+
+    <h3>Data connections</h3>
+    <p>Start a data connection by calling
+      <code>peer.connect</code> with the peer ID of the destination peer. Anytime another peer attempts to connect to
+      your peer ID, you'll receive
+      a
+      <code>connection</code> event. </p>
+    <div class="two-col">
+      <div class="col col-header">Start connection</div>
+      <div class="col col-header">Receive connection</div>
+      <div class="col">
+        <pre>var conn = peer.connect('dest-peer-id');</pre>
       </div>
-      <p><code>peer.connect</code> and the callback of the
+      <div class="col">
+        <pre>peer.on('connection', function(conn) { ... });</pre>
+      </div>
+      <div class="clear"></div>
+    </div>
+    <p>
+      <code>peer.connect</code> and the callback of the
       <code>connection</code> event will both provide a
       <code>DataConnection</code> object. This object will allow you to send and receive data:</p>
-      <pre>conn.on('open', function() {
+    <pre>conn.on('open', function() {
   // Receive messages
   conn.on('data', function(data) {
     console.log('Received', data);
@@ -68,52 +82,62 @@
   // Send messages
   conn.send('Hello!');
 });</pre>
-      <p>Read the <a href="#dataconnection">DataConnection API reference</a> for complete details on its methods and events.</p>
-      <h3>Video/audio calls</h3>
-      <p>Call another peer by calling <code>peer.call</code> with the peer ID of the destination
-      peer. When a peer calls you, the <code>call</code> event is emitted.</p>
-      <p>Unlike data connections, when receiving a <code>call</code> event, the call must be answered or no connection is established.</p>
-      <div class="two-col">
-        <div class="col col-header">Start call</div>
-        <div class="col col-header">Answer call</div>
-        <div class="col"><pre>// Call a peer, providing our mediaStream
+    <p>Read the
+      <a href="#dataconnection">DataConnection API reference</a> for complete details on its methods and events.</p>
+    <h3>Video/audio calls</h3>
+    <p>Call another peer by calling
+      <code>peer.call</code> with the peer ID of the destination peer. When a peer calls you, the
+      <code>call</code> event is emitted.</p>
+    <p>Unlike data connections, when receiving a
+      <code>call</code> event, the call must be answered or no connection is established.</p>
+    <div class="two-col">
+      <div class="col col-header">Start call</div>
+      <div class="col col-header">Answer call</div>
+      <div class="col">
+        <pre>// Call a peer, providing our mediaStream
 var call = peer.call('dest-peer-id',
   mediaStream);
 
-</pre></div>
-        <div class="col"><pre>peer.on('call', function(call) {
+</pre>
+      </div>
+      <div class="col">
+        <pre>peer.on('call', function(call) {
   // Answer the call, providing our mediaStream
   call.answer(mediaStream);
-});</pre></div>
-        <div class="clear"></div>
+});</pre>
       </div>
-      <p>When calling or answering a call, a MediaStream should be provided. The
-      MediaStream represents the local video (webcam) or audio stream and can be
-      obtained with some (browser-specific) version of <a
-        href="https://developer.mozilla.org/en-US/docs/Web/API/Navigator.getUserMedia"><code>navigator.getUserMedia</code></a>. When answering a
-      call, the MediaStream is optional and if none is provided then a one-way
-      call is established. Once the call is established, its <code>open</code> property is
-      set to true.</p>
-      <p><code>peer.call</code> and the callback of the <code>call</code> event
-      provide a MediaConnection object. The MediaConnection object itself emits
-      a <code>stream</code> event whose callback includes the video/audio stream of the other peer.</p>
-      <pre>call.on('stream', function(stream) {
+      <div class="clear"></div>
+    </div>
+    <p>When calling or answering a call, a MediaStream should be provided. The MediaStream represents the local video
+      (webcam)
+      or audio stream and can be obtained with some (browser-specific) version of
+      <a href="https://developer.mozilla.org/en-US/docs/Web/API/Navigator.getUserMedia">
+        <code>navigator.getUserMedia</code>
+      </a>. When answering a call, the MediaStream is optional and if none is provided then a one-way call is
+      established.
+      Once the call is established, its
+      <code>open</code> property is set to true.</p>
+    <p>
+      <code>peer.call</code> and the callback of the
+      <code>call</code> event provide a MediaConnection object. The MediaConnection object itself emits a
+      <code>stream</code> event whose callback includes the video/audio stream of the other peer.</p>
+    <pre>call.on('stream', function(stream) {
   // `stream` is the MediaStream of the remote peer.
   // Here you'd add it to an HTML video/canvas element.
 });</pre>
-      <p>Read the <a href="#mediaconnection">MediaConnection API reference</a> for complete details on its methods and events.</p>
+    <p>Read the
+      <a href="#mediaconnection">MediaConnection API reference</a> for complete details on its methods and events.</p>
 
-      <h2>Common questions</h2>
+    <h2>Common questions</h2>
 
-        <h3>What kind of data can I send?</h3>
+    <h3>What kind of data can I send?</h3>
 
-        <p>PeerJS has the <a
-          href="https://github.com/binaryjs/js-binarypack">BinaryPack</a>
-        serialization format built-in. This means you can send any JSON type as
-        well as binary Blobs and ArrayBuffers. Simply send arbitrary data and
-        you'll get it out the
-        other side:</p>
-          <pre>
+    <p>PeerJS has the
+      <a href="https://github.com/binaryjs/js-binarypack">BinaryPack</a>
+      serialization format built-in. This means you can send any JSON type as well as binary Blobs and ArrayBuffers.
+      Simply send
+      arbitrary data and you'll get it out the other side:</p>
+    <pre>
 conn.send({
   strings: 'hi!',
   numbers: 150,
@@ -122,17 +146,19 @@ conn.send({
   andMore: {bool: true}
 });</pre>
 
-        <h3>Are there any caveats?</h3>
-
-          <p>A small percentage of users are behind symmetric NATs. When two
-          symmetric NAT users try to connect to each other, NAT traversal is
-        impossible and no connection can be made. A workaround is to proxy
-      through the connection through a TURN server. The PeerServer cloud service does
-    not provide a TURN server. You'll have to find your own. You can pass a TURN
-  server into the <code>Peer</code> object options. This will allow your PeerJS app to work seamlessly for this situation</p>
-        <h3>How do I use a TURN server?</h3>
-        <p>When creating your Peer object, pass in the ICE servers as the config key of the options hash.</p>
-<pre>
+    <h3>Are there any caveats?</h3>
+
+    <p>A small percentage of users are behind symmetric NATs. When two symmetric NAT users try to connect to each other,
+      NAT
+      traversal is impossible and no connection can be made. A workaround is to proxy through the connection through a
+      TURN
+      server. The PeerServer cloud service does not provide a TURN server. You'll have to find your own. You can pass a
+      TURN
+      server into the
+      <code>Peer</code> object options. This will allow your PeerJS app to work seamlessly for this situation</p>
+    <h3>How do I use a TURN server?</h3>
+    <p>When creating your Peer object, pass in the ICE servers as the config key of the options hash.</p>
+    <pre>
 var peer = new Peer({
   config: {'iceServers': [
     { url: 'stun:stun.l.google.com:19302' },
@@ -140,41 +166,51 @@ var peer = new Peer({
   ]} /* Sample servers, please use appropriate ones */
 });
 </pre>
-        <h3>What is the current state of browser compatibility?</h3>
-
-          <p>We keep an frequently-updated catalogue of WebRTC compatibility
-          information and caveats <a href="/status">here</a>.</p>
-
-        <h3>What if my peer has not yet connected to the server when I attempt
-          to connect to it?</h3>
-
-          <p>When you try to connect to a peer, PeerServer will hold a
-          connection offer for up to 5 seconds before rejecting it. This is useful if you want to reconnect to a peer as it disconnects and reconnects rapidly between web pages.</p>
-
-        <h3>Why am I unable to connect?</h3>
-          <p>You could be behind a symmetric NAT, in which case you'll need to set up a TURN server.</p>
-          <p>Another possible issue is your network blocking port 9000, which the PeerServer cloud runs on. In this you must use your own PeerServer running on an appropriate port instead of the cloud service.</p>
-
-        <h3>What about latency/bandwidth?</h3>
-
-          <p>Data sent between the two peers do not touch any other servers, so the connection speed is limited only by the upload and download rates of the two peers. This also means you don't have the additional latency of an intermediary server.</p>
-          <p>The latency to establish a connection can be split into two
-          components:
-          the brokering of data and the identification of clients. PeerJS has been
-          designed to minimize the time you spend in these two areas. For
-          brokering, data is sent through an XHR streaming request before a WebSocket
-          connection is established, then through WebSockets. For client
-          identification, we provide you the ability to pass in your own peer
-          IDs, thus eliminating the RTT for retrieving an ID from the server.</p>
-
-        <h3>More questions?</h3>
-          <p><a
-            href="https://groups.google.com/forum/?fromgroups#!forum/peerjs">Discuss
-            PeerJS on our Google Group.</a><br><br></p>
+    <h3>What is the current state of browser compatibility?</h3>
+
+    <p>We keep an frequently-updated catalogue of WebRTC compatibility information and caveats
+      <a href="/status">here</a>.</p>
+
+    <h3>What if my peer has not yet connected to the server when I attempt to connect to it?</h3>
+
+    <p>When you try to connect to a peer, PeerServer will hold a connection offer for up to 5 seconds before rejecting
+      it. This
+      is useful if you want to reconnect to a peer as it disconnects and reconnects rapidly between web pages.</p>
+
+    <h3>Why am I unable to connect?</h3>
+    <p>You could be behind a symmetric NAT, in which case you'll need to set up a TURN server.</p>
+    <p>Another possible issue is your network blocking port 9000, which the PeerServer cloud runs on. In this you must
+      use your
+      own PeerServer running on an appropriate port instead of the cloud service.</p>
+
+    <h3>What about latency/bandwidth?</h3>
+
+    <p>Data sent between the two peers do not touch any other servers, so the connection speed is limited only by the
+      upload
+      and download rates of the two peers. This also means you don't have the additional latency of an intermediary
+      server.</p>
+    <p>The latency to establish a connection can be split into two components: the brokering of data and the
+      identification
+      of clients. PeerJS has been designed to minimize the time you spend in these two areas. For brokering, data is
+      sent
+      through an XHR streaming request before a WebSocket connection is established, then through WebSockets. For client
+      identification, we provide you the ability to pass in your own peer IDs, thus eliminating the RTT for retrieving
+      an
+      ID from the server.</p>
+
+    <h3>More questions?</h3>
+    <p>
+      <a href="https://groups.google.com/forum/?fromgroups#!forum/peerjs">Discuss PeerJS on our Google Group.</a>
+      <br>
+      <br>
+    </p>
   </section>
 
   <header class="left">
-    <h2>API Reference<a class="hide icon">&laquo;</a><a class="show icon">&raquo;</a></h2>
+    <h2>API Reference
+      <a class="hide icon">&laquo;</a>
+      <a class="show icon">&raquo;</a>
+    </h2>
   </header>
   <header class="right">
     <h2>Getting Started</h2>
@@ -184,4 +220,4 @@ var peer = new Peer({
     {{{html}}}
   </section>
 
-</body>
+</body>

Some files were not shown because too many files changed in this diff