diff --git a/clientapp/helpers/xmppEventHandlers.js b/clientapp/helpers/xmppEventHandlers.js index a8274f8..a7cdb07 100644 --- a/clientapp/helpers/xmppEventHandlers.js +++ b/clientapp/helpers/xmppEventHandlers.js @@ -86,6 +86,10 @@ module.exports = function (client, app) { window.location = '/login'; }); + client.on('stream:management:resumed', function () { + me.connected = true; + }); + client.on('session:started', function (jid) { me.jid = jid; diff --git a/clientapp/libraries/stanza.io.js b/clientapp/libraries/stanza.io.js index e069c51..d164f54 100644 --- a/clientapp/libraries/stanza.io.js +++ b/clientapp/libraries/stanza.io.js @@ -76,6 +76,8 @@ function Client(opts) { this._idPrefix = uuid.v4(); this._idCount = 0; + this.timeoutMonitor = null; + this.negotiatedFeatures = {}; this.featureOrder = [ 'sasl', @@ -407,8 +409,10 @@ Client.prototype.connect = function (opts) { _.extend(self.config, opts || {}); // Default iq timeout of 15 seconds - self.timeoutMonitor = new paddle.Paddle(self.config.timeout || 15); - self.timeoutMonitor.start(); + if (!self.timeoutMonitor) { + self.timeoutMonitor = new paddle.Paddle(self.config.timeout || 15); + self.timeoutMonitor.start(); + } if (self.config.wsURL) { return self.conn.connect(self.config); @@ -426,6 +430,7 @@ Client.prototype.connect = function (opts) { Client.prototype.disconnect = function () { this.timeoutMonitor.stop(); + this.timeoutMonitor = null; if (this.sessionStarted) { this.emit('session:end'); this.releaseGroup('session');