Skip to content

Commit

Permalink
v5.0.10 - When deauthenticating from the client-side, clear the token…
Browse files Browse the repository at this point in the history
… before invoking the callback
  • Loading branch information
jondubois committed Sep 12, 2016
1 parent 78ba490 commit 4169821
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "socketcluster-client",
"main": "socketcluster.js",
"version": "5.0.9",
"version": "5.0.10",
"homepage": "https://github.com/SocketCluster/socketcluster-client",
"description": "SocketCluster JavaScript client",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ module.exports.destroy = function (options) {
return SCSocketCreator.destroy(options);
};

module.exports.version = '5.0.9';
module.exports.version = '5.0.10';
4 changes: 2 additions & 2 deletions lib/scsocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,15 @@ SCSocket.prototype.deauthenticate = function (callback) {
var self = this;

this.auth.removeToken(this.options.authTokenName, function (err, oldToken) {
self.emit('#removeAuthToken');
callback && callback(err);
if (err) {
// Non-fatal error - Do not close the connection
self._onSCError(err);
} else {
self.emit('#removeAuthToken');
SCEmitter.prototype.emit.call(self, 'removeAuthToken', oldToken);
self._changeToUnauthenticatedState();
}
callback && callback(err);
});
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "socketcluster-client",
"description": "SocketCluster JavaScript client",
"version": "5.0.9",
"version": "5.0.10",
"homepage": "http://socketcluster.io",
"contributors": [
{
Expand Down
6 changes: 3 additions & 3 deletions socketcluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports.destroy = function (options) {
return SCSocketCreator.destroy(options);
};

module.exports.version = '5.0.9';
module.exports.version = '5.0.10';

},{"./lib/scsocket":4,"./lib/scsocketcreator":5,"sc-emitter":14}],2:[function(require,module,exports){
(function (global){
Expand Down Expand Up @@ -367,15 +367,15 @@ SCSocket.prototype.deauthenticate = function (callback) {
var self = this;

this.auth.removeToken(this.options.authTokenName, function (err, oldToken) {
self.emit('#removeAuthToken');
callback && callback(err);
if (err) {
// Non-fatal error - Do not close the connection
self._onSCError(err);
} else {
self.emit('#removeAuthToken');
SCEmitter.prototype.emit.call(self, 'removeAuthToken', oldToken);
self._changeToUnauthenticatedState();
}
callback && callback(err);
});
};

Expand Down
2 changes: 1 addition & 1 deletion socketcluster.min.js

Large diffs are not rendered by default.

0 comments on commit 4169821

Please sign in to comment.