ericz преди 12 години
родител
ревизия
a239b706f2
променени са 2 файла, в които са добавени 21 реда и са изтрити 11 реда
  1. 11 11
      examples/chat.html
  2. 10 0
      examples/readme.md

+ 11 - 11
examples/chat.html

@@ -10,21 +10,15 @@
 <script>
   
   var conn;
-  
   // Connect to PeerJS, have server assign an ID instead of providing one
   var peer = new Peer({key: 'lwjd5qra8257b9', debug: true});
-  
-  
   peer.on('open', function(id){
     $('#pid').text(id);
-  });
-  
+  });  
   // Await connections from others
   peer.on('connection', connect);
-
   function connect(c) {
     $('#chat_area').show();
-    
     conn = c;
     $('#messages').empty().append('Now chatting with ' + conn.peer);
     conn.on('data', function(data){
@@ -32,9 +26,7 @@
     });
     conn.on('close', function(err){ alert(conn.peer + ' has left the chat.') });
   }
-  
   $(document).ready(function() {
-    
     // Conect to a peer
     $('#connect').click(function(){
       var c = peer.connect($('#rid').val());
@@ -43,7 +35,6 @@
       });
       c.on('error', function(err){ alert(err) });  
     });
-    
     // Send a chat message
     $('#send').click(function(){
       var msg = $('#text').val();
@@ -51,13 +42,15 @@
       $('#messages').append('<br>You:<br>' + msg);
       $('#text').val('');
     });
-    
+    // Show browser version
+    $('#browsers').text(navigator.userAgent);
   });
 
 </script>
 </head> 
  
 <body> 
+
   Your PeerJS id is : <span id="pid"></span><br><br>
   Connect to peer: <input type="text" id="rid" placeholder="Someone else's id">
                    <input type="button" value="Connect" id="connect"><br><br>
@@ -69,5 +62,12 @@
     <input type="button" value="Send" id="send">
   </div>
   
+
+  
+  
+  <br><br><br>
+  <p style="font-size: 10px;">Your browser version: <span id="browsers"></span><br>
+  Currently <strong>Google Chrome 26.0.1403.0 or above</strong> is required (Dev or Canary channels)</strong><br><br>For more up to date compatibility information see <a href="http://peerjs.com/status">PeerJS WebRTC Status</a><br><br>Note that this demo may also fail if you are behind stringent firewalls or both you and the remote peer and behind symmetric NATs.</p>
+  
 </body> 
 </html> 

+ 10 - 0
examples/readme.md

@@ -0,0 +1,10 @@
+## PeerJS Demos / Examples
+
+**Due to browsers' incomplete support of the WebRTC DataChannel specification, many features of PeerJS have caveats.
+[View the status page for full details](http://peerjs.com/status).**
+
+###[API Reference](https://github.com/peers/peerjs/blob/master/docs/api.md)
+
+###[Getting started](http://peerjs.com/start)
+
+###[Browser compatibility and limitations](http://peerjs.com/status)