2021-02-10 23:24:24 +08:00
|
|
|
import RedisPubSub from '/imports/startup/server/redis';
|
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import { check } from 'meteor/check';
|
2021-05-05 01:34:31 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2021-02-10 23:24:24 +08:00
|
|
|
|
2021-10-16 03:07:13 +08:00
|
|
|
export default function updatePad(meetingId, userId, externalId, text) {
|
2021-02-10 23:24:24 +08:00
|
|
|
const REDIS_CONFIG = Meteor.settings.private.redis;
|
|
|
|
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
2021-10-16 03:07:13 +08:00
|
|
|
const EVENT_NAME = 'PadUpdatePubMsg';
|
2021-02-10 23:24:24 +08:00
|
|
|
|
2021-05-05 01:34:31 +08:00
|
|
|
try {
|
|
|
|
check(meetingId, String);
|
2021-10-16 03:07:13 +08:00
|
|
|
check(userId, String);
|
|
|
|
check(externalId, String);
|
|
|
|
check(text, String);
|
2021-02-10 23:24:24 +08:00
|
|
|
|
2021-05-05 01:34:31 +08:00
|
|
|
const payload = {
|
2021-10-16 03:07:13 +08:00
|
|
|
externalId,
|
|
|
|
text,
|
2023-11-30 23:10:36 +08:00
|
|
|
transcript: false,
|
2021-05-05 01:34:31 +08:00
|
|
|
};
|
2021-02-10 23:24:24 +08:00
|
|
|
|
2021-10-16 03:07:13 +08:00
|
|
|
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, userId, payload);
|
2021-05-05 01:34:31 +08:00
|
|
|
} catch (err) {
|
2021-10-16 03:07:13 +08:00
|
|
|
Logger.error(`Exception while invoking method updatePad ${err.stack}`);
|
2021-05-05 01:34:31 +08:00
|
|
|
}
|
2021-02-10 23:24:24 +08:00
|
|
|
}
|