Merge pull request #52 from MaybeRex/master
added triggers for 'close' and 'error' looks good
This commit is contained in:
commit
ffd358b5ed
1 changed files with 5 additions and 1 deletions
|
@ -102,6 +102,8 @@ function connect(){
|
||||||
'error',
|
'error',
|
||||||
function(err){
|
function(err){
|
||||||
client.log('\n\n######\nerror: '.error, err);
|
client.log('\n\n######\nerror: '.error, err);
|
||||||
|
client.trigger('error', err);
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -110,7 +112,7 @@ function connect(){
|
||||||
function(){
|
function(){
|
||||||
client.trigger('connect');
|
client.trigger('connect');
|
||||||
client.retriesRemaining=client.config.maxRetries;
|
client.retriesRemaining=client.config.maxRetries;
|
||||||
client.log('retrying reset')
|
client.log('retrying reset');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -123,6 +125,7 @@ function connect(){
|
||||||
client.config.stopRetrying || client.retriesRemaining<1
|
client.config.stopRetrying || client.retriesRemaining<1
|
||||||
|
|
||||||
){
|
){
|
||||||
|
client.trigger('disconnect');
|
||||||
client.log(
|
client.log(
|
||||||
client.config.id.variable,
|
client.config.id.variable,
|
||||||
'exceeded connection rety amount of'.warn,
|
'exceeded connection rety amount of'.warn,
|
||||||
|
@ -130,6 +133,7 @@ function connect(){
|
||||||
);
|
);
|
||||||
|
|
||||||
client.socket.destroy();
|
client.socket.destroy();
|
||||||
|
client.trigger('destroy');
|
||||||
client=undefined;
|
client=undefined;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue