bigbluebutton-Github/bigbluebutton-html5/imports/api/breakouts/server/methods/createBreakout.js

31 lines
950 B
JavaScript
Raw Normal View History

2018-10-24 01:18:09 +08:00
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import RedisPubSub from '/imports/startup/server/redis';
import Logger from '/imports/startup/server/logger';
2018-10-24 01:18:09 +08:00
2018-10-30 03:29:45 +08:00
export default function createBreakoutRoom(credentials, rooms, durationInMinutes, record = false) {
2018-10-24 01:18:09 +08:00
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const {
meetingId,
requesterUserId,
requesterToken,
} = credentials;
check(meetingId, String);
check(requesterUserId, String);
check(requesterToken, String);
const eventName = 'CreateBreakoutRoomsCmdMsg';
if (rooms.length > 8) return Logger.info(`Attempt to create breakout rooms with invalid number of rooms in meeting id=${meetingId}`);
2018-10-24 01:18:09 +08:00
const payload = {
record,
durationInMinutes,
rooms,
meetingId,
};
return RedisPubSub.publishUserMessage(CHANNEL, eventName, meetingId, requesterUserId, payload);
}