From 6a12279524ea3ba21811917ea2bd97e0c5a417b5 Mon Sep 17 00:00:00 2001 From: Darren Date: Fri, 19 Sep 2014 14:34:22 +0100 Subject: [PATCH] Cleaning up existing WebsocketRpc instances on reconnect --- client/src/models/gateway.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/src/models/gateway.js b/client/src/models/gateway.js index a8d8f1a..7fe7cf3 100644 --- a/client/src/models/gateway.js +++ b/client/src/models/gateway.js @@ -40,6 +40,10 @@ _kiwi.model.Gateway = Backbone.Model.extend({ reconnect_delay: 2000 }); + // If we have an existing RPC object, clean it up before replacing it + if (this.rpc) { + rpc.dispose(); + } this.rpc = new EngineioTools.Rpc(this.socket); this.socket.on('connect_failed', function (reason) { -- 2.25.1