|
@@ -5,8 +5,10 @@ var EventEmitter = require('eventemitter3');
|
|
|
* An abstraction on top of WebSockets and XHR streaming to provide fastest
|
|
|
* possible connection for peers.
|
|
|
*/
|
|
|
-function Socket(secure, host, port, path, key) {
|
|
|
- if (!(this instanceof Socket)) return new Socket(secure, host, port, path, key);
|
|
|
+function Socket(secure, host, port, path, key, wsport) {
|
|
|
+ if (!(this instanceof Socket)) return new Socket(secure, host, port, path, key, wsport);
|
|
|
+
|
|
|
+ wsport = wsport || port;
|
|
|
|
|
|
EventEmitter.call(this);
|
|
|
|
|
@@ -17,7 +19,7 @@ function Socket(secure, host, port, path, key) {
|
|
|
var httpProtocol = secure ? 'https://' : 'http://';
|
|
|
var wsProtocol = secure ? 'wss://' : 'ws://';
|
|
|
this._httpUrl = httpProtocol + host + ':' + port + path + key;
|
|
|
- this._wsUrl = wsProtocol + host + ':' + port + path + 'peerjs?key=' + key;
|
|
|
+ this._wsUrl = wsProtocol + host + ':' + wsport + path + 'peerjs?key=' + key;
|
|
|
}
|
|
|
|
|
|
util.inherits(Socket, EventEmitter);
|