Merge pull request #73 from Mostafa-Samir/disconnect/fix

Using a client-specific flag to disconnect instead of using config.stopRetrying
This commit is contained in:
Brandon Nozaki Miller 2016-07-14 16:02:33 -07:00 committed by GitHub
commit c2bffb5451
2 changed files with 6 additions and 3 deletions

View File

@ -16,7 +16,8 @@ function init(config,log){
connect : connect,
emit : emit,
log : log,
retriesRemaining:config.maxRetries||0
retriesRemaining:config.maxRetries||0,
explicitlyDisconnected: false
};
new Pubsub(client);
@ -143,7 +144,9 @@ function connect(){
);
if(
client.config.stopRetrying || client.retriesRemaining<1
client.config.stopRetrying ||
client.retriesRemaining<1 ||
client.explicitlyDisconnected
){
client.trigger('disconnect');

View File

@ -92,7 +92,7 @@ function disconnect(id){
return;
}
this.of[id].config.stopRetrying=true;
this.of[id].explicitlyDisconnected=true;
this.of[id].off('*');
if(this.of[id].socket){