2021-06-10 00:50:31 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2021-07-19 22:02:58 +08:00
|
|
|
import RedisPubSub from '/imports/startup/server/redis';
|
2021-06-10 00:50:31 +08:00
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
|
|
|
import { check } from 'meteor/check';
|
|
|
|
|
2021-07-19 22:02:58 +08:00
|
|
|
export default function changeLayout(layout) {
|
|
|
|
const REDIS_CONFIG = Meteor.settings.private.redis;
|
|
|
|
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
|
|
|
const EVENT_NAME = 'BroadcastLayoutMsg';
|
|
|
|
|
2021-06-10 00:50:31 +08:00
|
|
|
try {
|
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
|
|
|
|
|
|
|
check(meetingId, String);
|
|
|
|
check(requesterUserId, String);
|
|
|
|
|
2021-07-19 22:02:58 +08:00
|
|
|
const payload = {
|
|
|
|
layout,
|
2021-06-10 00:50:31 +08:00
|
|
|
};
|
|
|
|
|
2021-07-19 22:02:58 +08:00
|
|
|
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
2021-06-10 00:50:31 +08:00
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Exception while invoking method changeLayout ${err.stack}`);
|
|
|
|
}
|
|
|
|
}
|