Michelle Bu преди 11 години
родител
ревизия
7a2fd81ccb
променени са 1 файла, в които са добавени 9 реда и са изтрити 0 реда
  1. 9 0
      lib/peer.js

+ 9 - 0
lib/peer.js

@@ -21,6 +21,7 @@ function Peer(id, options) {
     host: util.CLOUD_HOST,
     port: util.CLOUD_PORT,
     key: 'peerjs',
+    path: '/',
     config: util.defaultConfig
   }, options);
   this.options = options;
@@ -28,6 +29,14 @@ function Peer(id, options) {
   if (options.host === '/') {
     options.host = window.location.hostname;
   }
+  // Set path correctly.
+  if (options.path[0] !== '/') {
+    options.path = '/' + options.path;
+  }
+  if (options.path[options.path.length - 1] !== '/') {
+    options.path += '/';
+  }
+
   // Set whether we use SSL to same as current host
   if (options.secure === undefined && options.host !== util.CLOUD_HOST) {
     options.secure = util.isSecure();