Skip to content

Commit

Permalink
fix: do not log updateUserStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Oct 19, 2023
1 parent 4002c8d commit f98961b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,16 @@ class SocketServer extends EventEmitter {

if (self.authenticate) {
const { user_id, expires } = self.authenticate.decodeToken(options.token)

const userStatus = { socket, method: 'userStatus', user_id: options.user_id, userStatus: 'off', organization_id }
if (user_id) {
options.user_id = user_id
socket.user_id = user_id;
socket.expires = expires;
self.emit('userStatus', { socket, method: 'userStatus', user_id, userStatus: 'on', organization_id });
userStatus.userStatus = 'on'
self.emit("notification.user", socket)
} else
self.emit('userStatus', { socket, user_id: options.user_id, userStatus: 'off', organization_id });
}

self.emit('userStatus', userStatus);

self.onWebSocket(socket);

Expand Down Expand Up @@ -419,7 +421,7 @@ class SocketServer extends EventEmitter {
if (authorized && authorized.authorized)
data = authorized.authorized

if (!data.method.startsWith('read.') || data.log) {
if (!data.method.startsWith('read.') || data.log || data.method !== 'updateUserStatus' || data.method !== 'userStatus') {
let object = { url: socket.socketUrl, data }
delete object.socket
this.emit('create.object', {
Expand Down

0 comments on commit f98961b

Please sign in to comment.