bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/methods/setMobileUser.js
2023-04-06 17:43:57 -03:00

29 lines
946 B
JavaScript

import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import { extractCredentials } from '/imports/api/common/server/helpers';
import RedisPubSub from '/imports/startup/server/redis';
export default async function setMobileUser() {
try {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'ChangeUserMobileFlagReqMsg';
const { meetingId, requesterUserId } = extractCredentials(this.userId);
check(meetingId, String);
check(requesterUserId, String);
const payload = {
userId: requesterUserId,
mobile: true,
};
Logger.verbose(`Mobile user ${requesterUserId} from meeting ${meetingId}`);
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
} catch (err) {
Logger.error(`Exception while invoking method setMobileUser ${err.stack}`);
}
}