-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
when calling .disconnect(), you're performing a socket.end() but providing no callback for when the socket is completely closed. You could do this by listening to the 'close' event, i.e.
AsteriskAmi.prototype.disconnect = function(callback){
this.reconnect = false;
this.socket.on('close', function () {
callback();
});
this.socket.end(this.generateSocketData({Action: 'Logoff'}));
}
You shouldn't need to remove the close listener on the socket because the socket should be destroyed when the connection is closed.
Sorry I'm lazy and didn't do a PR because this was just a tangential thought while reviewing someone's code.
Metadata
Metadata
Assignees
Labels
No labels