diff --git a/lib/wsapp.js b/lib/wsapp.js index d307be2..2a56a38 100644 --- a/lib/wsapp.js +++ b/lib/wsapp.js @@ -20,7 +20,7 @@ var io, bcMonitor; var WsApp = function() {}; -WsApp._unauthorized = function() { +WsApp._unauthorized = function(socket) { socket.emit('unauthorized'); socket.disconnect(); }; @@ -52,10 +52,10 @@ WsApp.start = function(server) { socket.emit('challenge', socket.nonce); socket.on('authorize', function(data) { - if (data.message != socket.nonce) return WsApp.unauthorized(); + if (data.message != socket.nonce) return WsApp._unauthorized(socket); WalletService.getInstanceWithAuth(data, function(err, service) { - if (err) return WsApp.unauthorized(); + if (err) return WsApp._unauthorized(socket); socket.join(service.walletId); socket.emit('authorized');