2017-08-01 02:48:56 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import RedisPubSub from '/imports/startup/server/redis2x';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
2017-08-31 00:31:08 +08:00
|
|
|
import { buildMessageHeader } from '/imports/api/common/server/helpers';
|
2017-08-01 02:48:56 +08:00
|
|
|
|
|
|
|
export default function userJoin(meetingId, userId, authToken) {
|
|
|
|
const REDIS_CONFIG = Meteor.settings.redis;
|
|
|
|
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
|
|
|
const EVENT_NAME = 'UserJoinMeetingReqMsg';
|
|
|
|
|
|
|
|
check(meetingId, String);
|
|
|
|
check(userId, String);
|
|
|
|
check(authToken, String);
|
|
|
|
|
|
|
|
const payload = {
|
|
|
|
userId,
|
|
|
|
authToken,
|
|
|
|
};
|
|
|
|
|
|
|
|
Logger.info(`User '${userId}' is joining meeting '${meetingId}'`);
|
|
|
|
|
2017-08-31 00:31:08 +08:00
|
|
|
const header = buildMessageHeader(EVENT_NAME, meetingId, userId);
|
|
|
|
|
2017-09-06 22:17:46 +08:00
|
|
|
return RedisPubSub.publ(CHANNEL, EVENT_NAME, meetingId, payload, header);
|
2017-08-01 02:48:56 +08:00
|
|
|
}
|