Browse Source

Merge pull request #517 from afrokick/fix/defaultSerializationType-516

fix #515 #516
afrokick 6 years ago
parent
commit
eb67508ebc
5 changed files with 8 additions and 9 deletions
  1. 0 0
      dist/peerjs.min.js
  2. 0 0
      dist/peerjs.min.js.map
  3. 0 1
      lib/baseconnection.ts
  4. 7 7
      lib/dataconnection.ts
  5. 1 1
      lib/peer.ts

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


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


+ 0 - 1
lib/baseconnection.ts

@@ -25,7 +25,6 @@ export abstract class BaseConnection extends EventEmitter {
     super();
 
     this.metadata = options.metadata;
-    this.connectionId = options.connectionId;
   }
 
   abstract close(): void;

+ 7 - 7
lib/dataconnection.ts

@@ -46,20 +46,20 @@ export class DataConnection extends BaseConnection {
     super(peerId, provider, options);
 
     this.connectionId =
-      options.connectionId || DataConnection.ID_PREFIX + util.randomToken();
+      this.options.connectionId || DataConnection.ID_PREFIX + util.randomToken();
 
-    this.label = options.label || this.connectionId;
-    this.serialization = options.serialization;
-    this.reliable = options.reliable;
+    this.label = this.options.label || this.connectionId;
+    this.serialization = this.options.serialization || SerializationType.Binary;
+    this.reliable = this.options.reliable;
 
-    if (options._payload) {
-      this._peerBrowser = options._payload.browser;
+    if (this.options._payload) {
+      this._peerBrowser = this.options._payload.browser;
     }
 
     this._negotiator = new Negotiator(this);
 
     this._negotiator.startConnection(
-      options._payload || {
+      this.options._payload || {
         originator: true
       }
     );

+ 1 - 1
lib/peer.ts

@@ -335,7 +335,7 @@ export class Peer extends EventEmitter {
    * Returns a DataConnection to the specified peer. See documentation for a
    * complete list of options.
    */
-  connect(peer: string, options?: PeerConnectOption): DataConnection {
+  connect(peer: string, options: PeerConnectOption = {}): DataConnection {
     if (this.disconnected) {
       logger.warn(
         "You cannot connect to a new Peer because you called " +

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