Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
this.json = new Flag(this, 'json');
this.ackPackets = 0;
this.acks = {};
this.connected = false;
};

/**
Expand Down Expand Up @@ -158,6 +159,7 @@
} else {
this.$emit('disconnect', packet.reason);
}
this.connected = false;
break;

case 'message':
Expand Down
20 changes: 13 additions & 7 deletions lib/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,19 @@
*/

Socket.prototype.of = function (name) {
if (!this.namespaces[name]) {
if (!this.namespaces[name]) {
this.namespaces[name] = new io.SocketNamespace(this, name);

if (name !== '') {
this.namespaces[name].packet({ type: 'connect' });
this.namespaces[name].connected = true;
this.namespaces[name].packet({ type: 'connect' });
}
}
} else {
if (!this.namespaces[name].connected) {
this.namespaces[name].connected = true;
this.namespaces[name].packet({ type: 'connect' });
}
}

return this.namespaces[name];
};
Expand Down Expand Up @@ -161,7 +167,7 @@
} else if (xhr.status == 403) {
self.onError(xhr.responseText);
} else {
self.connecting = false;
self.connecting = false;
!self.reconnecting && self.onError(xhr.responseText);
}
}
Expand Down Expand Up @@ -205,7 +211,7 @@

var self = this;
self.connecting = true;

this.handshake(function (sid, heartbeat, close, transports) {
self.sessionid = sid;
self.closeTimeout = close * 1000;
Expand Down Expand Up @@ -327,7 +333,7 @@
this.transport.payload(this.buffer);
this.buffer = [];
};


/**
* Disconnect the established connect.
Expand Down Expand Up @@ -390,7 +396,7 @@
var port = global.location.port ||
('https:' == global.location.protocol ? 443 : 80);

return this.options.host !== global.location.hostname
return this.options.host !== global.location.hostname
|| this.options.port != port;
};

Expand Down