in content/lib/paho-mqtt.js [857:884]
ClientImpl.prototype.connect = function (connectOptions) {
var connectOptionsMasked = this._traceMask(connectOptions, "password");
this._trace("Client.connect", connectOptionsMasked, this.socket, this.connected);
if (this.connected)
throw new Error(format(ERROR.INVALID_STATE, ["already connected"]));
if (this.socket)
throw new Error(format(ERROR.INVALID_STATE, ["already connected"]));
if (this._reconnecting) {
// connect() function is called while reconnect is in progress.
// Terminate the auto reconnect process to use new connect options.
this._reconnectTimeout.cancel();
this._reconnectTimeout = null;
this._reconnecting = false;
}
this.connectOptions = connectOptions;
this._reconnectInterval = 1;
this._reconnecting = false;
if (connectOptions.uris) {
this.hostIndex = 0;
this._doConnect(connectOptions.uris[0]);
} else {
this._doConnect(this.uri);
}
};