Fix secure configuration; Boolean constructor should be string

This commit is contained in:
wltsmrz
2013-08-16 13:15:16 -07:00
parent 8b69dfd154
commit e3edd5267d

View File

@@ -24,7 +24,7 @@ function Server(remote, opts) {
this._opts = opts; this._opts = opts;
this._host = opts.host; this._host = opts.host;
this._port = opts.port; this._port = opts.port;
this._secure = typeof opts.secure === Boolean ? opts.secure : true; this._secure = typeof opts.secure === 'boolean' ? opts.secure : true;
this._ws = void(0); this._ws = void(0);
this._connected = false; this._connected = false;
this._should_connect = false; this._should_connect = false;
@@ -33,8 +33,7 @@ function Server(remote, opts) {
this._retry = 0; this._retry = 0;
this._requests = { }; this._requests = { };
this._opts.url = (opts.secure ? 'wss://' : 'ws://') this._opts.url = (opts.secure ? 'wss://' : 'ws://') + opts.host + ':' + opts.port;
+ [ opts.host, opts.port ].join(':');
this.on('message', function(message) { this.on('message', function(message) {
self._handle_message(message); self._handle_message(message);