From 78354438e064af8d309e8e8302b9c7f0b0117a9c Mon Sep 17 00:00:00 2001 From: Darren Date: Fri, 23 May 2014 16:44:04 +0100 Subject: [PATCH] Reconnecting fix --- client/src/models/application.js | 5 ++++- client/src/models/gateway.js | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/client/src/models/application.js b/client/src/models/application.js index 2318f47..43af0b4 100644 --- a/client/src/models/application.js +++ b/client/src/models/application.js @@ -218,7 +218,8 @@ }); - gw.on('connect', function (event) { + // After the socket has connected, kiwi handshakes and then triggers a kiwi:connected event + gw.on('kiwi:connected', function (event) { that.view.$el.addClass('connected'); if (gw_stat !== 1) return; @@ -229,6 +230,8 @@ // Mention the re-connection on every channel _kiwi.app.connections.forEach(function(connection) { + connection.reconnect(); + connection.panels.server.addMsg('', styleText('rejoin', {text: msg}), 'action join'); connection.panels.forEach(function(panel) { diff --git a/client/src/models/gateway.js b/client/src/models/gateway.js index cd4baa9..1de6fa4 100644 --- a/client/src/models/gateway.js +++ b/client/src/models/gateway.js @@ -195,9 +195,6 @@ _kiwi.model.Gateway = function () { this.parseKiwi = function (command, data) { var args; - this.trigger('kiwi:' + command, data); - this.trigger('kiwi', data); - switch (command) { case 'connected': // Send some info on this client to the server @@ -211,6 +208,9 @@ _kiwi.model.Gateway = function () { break; } + + this.trigger('kiwi:' + command, data); + this.trigger('kiwi', data); }; /** -- 2.25.1