client: added disconnect method

This commit is contained in:
Guillermo Rauch
2012-12-18 14:55:42 -03:00
parent 3feb98a346
commit 19837a0f86

View File

@@ -62,6 +62,22 @@ Client.prototype.connect = function(name){
});
};
/**
* Disconnects from all namespaces and closes transport.
*
* @api private
*/
Client.prototype.disconnect = function(){
var socket;
// we don't use a for loop because the length of
// `sockets` changes upon each iteration
while (socket = this.sockets.shift()) {
socket.disconnect();
}
this.close();
};
/**
* Removes a socket. Called by each `Socket`.
*