bigbluebutton-Github/bigbluebutton-html5/imports/api/meetings/server/methods/endMeeting.js

28 lines
946 B
JavaScript
Raw Normal View History

2017-09-07 03:36:52 +08:00
import { Meteor } from 'meteor/meteor';
import RedisPubSub from '/imports/startup/server/redis';
2017-09-07 03:36:52 +08:00
import Logger from '/imports/startup/server/logger';
import { extractCredentials } from '/imports/api/common/server/helpers';
import { check } from 'meteor/check';
2017-09-07 03:36:52 +08:00
export default function endMeeting() {
const REDIS_CONFIG = Meteor.settings.private.redis;
2017-09-07 03:36:52 +08:00
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'LogoutAndEndMeetingCmdMsg';
2021-05-05 20:58:17 +08:00
try {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
2021-05-05 20:58:17 +08:00
check(meetingId, String);
check(requesterUserId, String);
2021-05-05 20:58:17 +08:00
const payload = {
userId: requesterUserId,
};
Logger.warn(`Meeting '${meetingId}' is destroyed by '${requesterUserId}'`);
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
} catch (err) {
Logger.error(`Exception while invoking method endMeeting ${err.stack}`);
}
2017-09-07 03:36:52 +08:00
}