Skip to content

Commit

Permalink
Merge pull request #608 from nkzawa/patch-2
Browse files Browse the repository at this point in the history
fix a namespace connection error
  • Loading branch information
rauchg committed Mar 2, 2014
2 parents a3e4cae + fc4cdb4 commit a9b8bb9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,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();
};

/**
Expand Down
13 changes: 13 additions & 0 deletions test/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ describe('connection', function() {
});
});

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();
});
});
});

if (!global.Blob && !global.ArrayBuffer) {
it('should get base64 data as a last resort', function(done) {
socket.on('takebin', function(a) {
Expand Down

0 comments on commit a9b8bb9

Please sign in to comment.