Browse Source

Fix label/serialization stuff

Michelle Bu 12 years ago
parent
commit
2fae052182
5 changed files with 16 additions and 4 deletions
  1. 6 0
      dist/peer.js
  2. 0 0
      dist/peer.min.js
  3. 4 4
      examples/chat.html
  4. 5 0
      lib/negotiator.js
  5. 1 0
      lib/socket.js

+ 6 - 0
dist/peer.js

@@ -1901,6 +1901,7 @@ Negotiator._getPeerConnection = function(connection, options) {
 
   var pc;
   if (options.multiplex) {
+    // TODO: this doesn't work right now because we don't have PC ids.
     // Find an existing PC to use.
     ids = Object.keys(peerConnections);
     for (var i = 0, ii = ids.length; i < ii; i += 1) {
@@ -2041,6 +2042,10 @@ Negotiator._makeOffer = function(connection) {
         payload: {
           sdp: offer,
           type: connection.type,
+          label: connection.label,
+          reliable: connection.reliable,
+          serialization: connection.serialization,
+          metadata: connection.metadata,
           connectionId: connection.id
         },
         dst: connection.peer,
@@ -2293,6 +2298,7 @@ Socket.prototype._sendQueuedMessages = function() {
 
 /** Exposed send for DC & Peer. */
 Socket.prototype.send = function(data) {
+  console.log(data)
   if (this.disconnected) {
     return;
   }

File diff suppressed because it is too large
+ 0 - 0
dist/peer.min.js


+ 4 - 4
examples/chat.html

@@ -8,19 +8,19 @@
 <link href="fancy.css" rel="stylesheet" type="text/css">
 <script>
   // Just for demo.
-  console._log = console.log;
+  /*console._log = console.log;
   console.log = function() {
     var copy = Array.prototype.slice.call(arguments).join(' ');
     $('.log').append(copy + '<br>');
     console._log(copy);
-  };
+  };*/
 </script>
 
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script> 
-<script type="text/javascript" src="http://cdn.peerjs.com/0/peer.js"></script>
+<script type="text/javascript" src="../dist/peer.js"></script>
 <script>
 // Connect to PeerJS, have server assign an ID instead of providing one
-var peer = new Peer({key: 'lwjd5qra8257b9', debug: true});
+var peer = new Peer({key: 'lwjd5qra8257b9', debug: 3});
 
 // Show this peer's ID.
 peer.on('open', function(id){

+ 5 - 0
lib/negotiator.js

@@ -56,6 +56,7 @@ Negotiator._getPeerConnection = function(connection, options) {
 
   var pc;
   if (options.multiplex) {
+    // TODO: this doesn't work right now because we don't have PC ids.
     // Find an existing PC to use.
     ids = Object.keys(peerConnections);
     for (var i = 0, ii = ids.length; i < ii; i += 1) {
@@ -196,6 +197,10 @@ Negotiator._makeOffer = function(connection) {
         payload: {
           sdp: offer,
           type: connection.type,
+          label: connection.label,
+          reliable: connection.reliable,
+          serialization: connection.serialization,
+          metadata: connection.metadata,
           connectionId: connection.id
         },
         dst: connection.peer,

+ 1 - 0
lib/socket.js

@@ -163,6 +163,7 @@ Socket.prototype._sendQueuedMessages = function() {
 
 /** Exposed send for DC & Peer. */
 Socket.prototype.send = function(data) {
+  console.log(data)
   if (this.disconnected) {
     return;
   }

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