bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/methods/setMobileUser.js

29 lines
946 B
JavaScript
Raw Normal View History

2019-11-20 01:49:18 +08:00
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';
2019-11-20 01:49:18 +08:00
export default async function setMobileUser() {
2021-05-06 00:47:43 +08:00
try {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'ChangeUserMobileFlagReqMsg';
2021-05-06 00:47:43 +08:00
const { meetingId, requesterUserId } = extractCredentials(this.userId);
2019-11-20 01:49:18 +08:00
2021-05-06 00:47:43 +08:00
check(meetingId, String);
check(requesterUserId, String);
2019-11-20 01:49:18 +08:00
const payload = {
userId: requesterUserId,
mobile: true,
};
2021-05-06 00:47:43 +08:00
Logger.verbose(`Mobile user ${requesterUserId} from meeting ${meetingId}`);
2019-11-20 01:49:18 +08:00
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
2021-05-06 00:47:43 +08:00
} catch (err) {
Logger.error(`Exception while invoking method setMobileUser ${err.stack}`);
}
2019-11-20 01:49:18 +08:00
}