bigbluebutton-Github/bigbluebutton-html5/imports/api/voice-users/server/publishers.js
prlanzarin fb30b145af refactor: remove unused VU ejection on socket disconnection
The voice user ejection callback tethered to Meteor's socket
disconnection seems broken (since its introduction). The VU selector
uses an invalid field (requesterUserId) - so no VU is ever returned.

Since I'm unaware of the original goal behind this code and there's
already ejections in place in other components (akka-apps, for
instance), this is basically a revert of #9888.
2023-04-11 15:58:22 -03:00

27 lines
955 B
JavaScript

import VoiceUsers from '/imports/api/voice-users';
import { Meteor } from 'meteor/meteor';
import Logger from '/imports/startup/server/logger';
import AuthTokenValidation, { ValidationStates } from '/imports/api/auth-token-validation';
async function voiceUser() {
const tokenValidation = await AuthTokenValidation
.findOneAsync({ connectionId: this.connection.id });
if (!tokenValidation || tokenValidation.validationStatus !== ValidationStates.VALIDATED) {
Logger.warn(`Publishing VoiceUsers was requested by unauth connection ${this.connection.id}`);
return VoiceUsers.find({ meetingId: '' });
}
const { meetingId, userId: requesterUserId } = tokenValidation;
Logger.debug('Publishing Voice User', { meetingId, requesterUserId });
return VoiceUsers.find({ meetingId });
}
function publish(...args) {
const boundVoiceUser = voiceUser.bind(this);
return boundVoiceUser(...args);
}
Meteor.publish('voiceUsers', publish);