Skip to content

Commit

Permalink
RPS hook: Future-proof (#7311)
Browse files Browse the repository at this point in the history
Adjusts for unnecessary `return true` pointed out in balderdashy/sails-hook-sockets#50, which will eventually no longer be a thing.  (Starting with the rps hook not using it.)
  • Loading branch information
mikermcneil authored Dec 14, 2023
1 parent 3b789f1 commit c4cd453
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions lib/hooks/pubsub/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,14 @@ module.exports = function(sails) {
sails.log.debug('Wrapping it in an array for you this time...');
}

_.each(ids,function (id) {
for (let id of ids) {
// Attempt to join the room for the specified instance.
if (sails.sockets.join( socket, self._room(id) )) {
sails.log.silly(
'Subscribed to the ' +
self.globalId + ' with id=' + id + '\t(room :: ' + self._room(id) + ')'
);
}
});
sails.sockets.join( socket, self._room(id) );
sails.log.silly(
'Subscribed to the ' +
self.globalId + ' with id=' + id + '\t(room :: ' + self._room(id) + ')'
);
}//∞
},

/**
Expand Down Expand Up @@ -325,15 +324,14 @@ module.exports = function(sails) {
sails.log.debug('Wrapping it in an array for you this time...');
}

_.each(ids,function (id) {
for (let id of ids) {
// Attempt to leave the room for the specified instance.
if (sails.sockets.leave( socket, self._room(id))) {
sails.log.silly(
'Unsubscribed from the ' +
self.globalId + ' with id=' + id + '\t(room :: ' + self._room(id) + ')'
);
}
});
sails.sockets.leave( socket, self._room(id));
sails.log.silly(
'Unsubscribed from the ' +
self.globalId + ' with id=' + id + '\t(room :: ' + self._room(id) + ')'
);
}//∞
},

/**
Expand Down

0 comments on commit c4cd453

Please sign in to comment.