diff --git a/lib/client.js b/lib/client.js index 2c9fa5b..f8919b2 100644 --- a/lib/client.js +++ b/lib/client.js @@ -446,6 +446,8 @@ Client.prototype.handleSubscribe = function(packet) { that.close(); return; } + + that.server.persistClient(that); packet.subscriptions.forEach(function(sub, index) { if (authorized[index]) { @@ -563,7 +565,6 @@ Client.prototype.close = function(callback) { // needed in case of errors if (!that._closed) { - that.server.persistClient(that); cleanup(); that.connection.stream.end(); }