From 512eb3a8a4f60f52de80639c2529d4e98daa03a6 Mon Sep 17 00:00:00 2001 From: Tony Kovanen Date: Sun, 19 Oct 2014 21:34:53 +0300 Subject: [PATCH 1/3] Set `readyState` before engine.io close event. This way we don't need to possibly wait for a drain event before we actually change the readyState and don't miss reconnects, which currently happens when linked against the current engine.io-client master. --- lib/manager.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/manager.js b/lib/manager.js index 7a8defc2b..f2ab2a22a 100644 --- a/lib/manager.js +++ b/lib/manager.js @@ -386,6 +386,7 @@ Manager.prototype.cleanup = function(){ Manager.prototype.close = Manager.prototype.disconnect = function(){ this.skipReconnect = true; + this.readyState = 'closed'; this.engine && this.engine.close(); }; From 5be8d414bf44f688c4841b276921e95ef7937644 Mon Sep 17 00:00:00 2001 From: Tony Kovanen Date: Sun, 19 Oct 2014 21:37:46 +0300 Subject: [PATCH 2/3] Bump engine.io-client. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b767985ab..4da2b22ac 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ ], "dependencies": { "debug": "0.7.4", - "engine.io-client": "1.4.0", + "engine.io-client": "Automattic/engine.io-client#6d908e", "component-bind": "1.0.0", "component-emitter": "1.1.2", "object-component": "0.0.3", From 361acede8e2827762283a4c65bbb98e368d872e8 Mon Sep 17 00:00:00 2001 From: Tony Kovanen Date: Sun, 19 Oct 2014 22:05:07 +0300 Subject: [PATCH 3/3] Increase timeout. Increased timeout in tests before closing the manager engine so reconnects will take place with more certainty. --- test/connection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/connection.js b/test/connection.js index ed5d645d9..faa179cb2 100644 --- a/test/connection.js +++ b/test/connection.js @@ -206,7 +206,7 @@ describe('connection', function() { setTimeout(function() { manager.engine.close(); - }, 500); + }, 1000); }); it('should try to reconnect twice and fail when requested two attempts with immediate timeout and reconnect enabled', function(done) {