From 78f1fd152face37b45ef7b0f194c22448aaa17dc Mon Sep 17 00:00:00 2001 From: Naoyuki Kanezawa Date: Thu, 6 Feb 2014 05:03:25 +0900 Subject: [PATCH] fix a namespace connection error --- lib/socket.js | 2 +- test/connection.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/socket.js b/lib/socket.js index 6ba0f7c118..f7b26d9871 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -67,11 +67,11 @@ Socket.prototype.open = Socket.prototype.connect = function(){ var io = this.io; io.open(); // ensure open - if ('open' == this.io.readyState) this.onopen(); this.subs = [ on(io, 'open', bind(this, 'onopen')), on(io, 'error', bind(this, 'onerror')) ]; + if ('open' == this.io.readyState) this.onopen(); }; /** diff --git a/test/connection.js b/test/connection.js index a393687f73..989d91eba8 100644 --- a/test/connection.js +++ b/test/connection.js @@ -9,4 +9,17 @@ describe('connection', function() { done(); }); }); + + it('should connect to a namespace after connection established', function(done) { + var manager = io.Manager(); + var socket = manager.socket('/'); + socket.on('connect', function(){ + var foo = manager.socket('/foo'); + foo.on('connect', function(){ + foo.close(); + socket.close(); + done(); + }); + }); + }); });