Skip direct messages of flash client

This commit is contained in:
Tainan Felipe 2018-04-12 10:41:32 -03:00
parent d259a875f6
commit d9f90943ee
6 changed files with 25 additions and 8 deletions

View File

@ -1,4 +1,5 @@
import RedisPubSub from '/imports/startup/server/redis';
import { skipFlashDirectEvent } from '/imports/api/common/server/helpers';
import handleWhiteboardCleared from './handlers/whiteboardCleared';
import handleWhiteboardUndo from './handlers/whiteboardUndo';
import handleWhiteboardSend from './handlers/whiteboardSend';
@ -7,4 +8,4 @@ import handleWhiteboardAnnotations from './handlers/whiteboardAnnotations';
RedisPubSub.on('ClearWhiteboardEvtMsg', handleWhiteboardCleared);
RedisPubSub.on('UndoWhiteboardEvtMsg', handleWhiteboardUndo);
RedisPubSub.on('SendWhiteboardAnnotationEvtMsg', handleWhiteboardSend);
RedisPubSub.on('GetWhiteboardAnnotationsRespMsg', handleWhiteboardAnnotations);
RedisPubSub.on('GetWhiteboardAnnotationsRespMsg', skipFlashDirectEvent(handleWhiteboardAnnotations));

View File

@ -1,9 +1,10 @@
import RedisPubSub from '/imports/startup/server/redis';
import { skipFlashDirectEvent } from '/imports/api/common/server/helpers';
import handleCaptionHistory from './handlers/captionHistory';
import handleCaptionUpdate from './handlers/captionUpdate';
import handleCaptionOwnerUpdate from './handlers/captionOwnerUpdate';
// TODO
RedisPubSub.on('SendCaptionHistoryRespMsg', handleCaptionHistory);
RedisPubSub.on('SendCaptionHistoryRespMsg', skipFlashDirectEvent(handleCaptionHistory));
RedisPubSub.on('EditCaptionHistoryEvtMsg', handleCaptionUpdate);
RedisPubSub.on('UpdateCaptionOwnerEvtMsg', handleCaptionOwnerUpdate);

View File

@ -1,9 +1,10 @@
import RedisPubSub from '/imports/startup/server/redis';
import { skipFlashDirectEvent } from '/imports/api/common/server/helpers';
import handleChatMessage from './handlers/chatMessage';
import handleChatHistory from './handlers/chatHistory';
import handleChatPublicHistoryClear from './handlers/chatPublicHistoryClear';
RedisPubSub.on('GetChatHistoryRespMsg', handleChatHistory);
RedisPubSub.on('GetChatHistoryRespMsg', skipFlashDirectEvent(handleChatHistory));
RedisPubSub.on('SendPublicMessageEvtMsg', handleChatMessage);
RedisPubSub.on('SendPrivateMessageEvtMsg', handleChatMessage);
RedisPubSub.on('SendPrivateMessageEvtMsg', skipFlashDirectEvent(handleChatMessage));
RedisPubSub.on('ClearPublicChatHistoryEvtMsg', handleChatPublicHistoryClear);

View File

@ -1,5 +1,8 @@
import WhiteboardMultiUser from '/imports/api/whiteboard-multi-user/';
const MSG_DIRECT_TYPE = 'DIRECT';
const NODE_USER = 'nodeJSapp';
export const indexOf = [].indexOf || function (item) {
for (let i = 0, l = this.length; i < l; i += 1) {
if (i in this && this[i] === item) {
@ -10,8 +13,17 @@ export const indexOf = [].indexOf || function (item) {
return -1;
};
// used in 1.1
export const inReplyToHTML5Client = arg => arg.routing.userId === 'nodeJSapp';
export const skipFlashDirectEvent = fn => (message, ...args) => {
const { envelope } = message;
const { routing } = envelope;
const shouldSkip = routing.msgType === MSG_DIRECT_TYPE && routing.userId !== NODE_USER;
if (shouldSkip) return () => { };
return fn(...args);
};
export const getMultiUserStatus = (meetingId) => {
const data = WhiteboardMultiUser.findOne({ meetingId });

View File

@ -1,4 +1,5 @@
import RedisPubSub from '/imports/startup/server/redis';
import { skipFlashDirectEvent } from '/imports/api/common/server/helpers';
import handleJoinVoiceUser from './handlers/joinVoiceUser';
import handleLeftVoiceUser from './handlers/leftVoiceUser';
import handleTalkingVoiceUser from './handlers/talkingVoiceUser';
@ -9,4 +10,4 @@ RedisPubSub.on('UserLeftVoiceConfToClientEvtMsg', handleLeftVoiceUser);
RedisPubSub.on('UserJoinedVoiceConfToClientEvtMsg', handleJoinVoiceUser);
RedisPubSub.on('UserTalkingVoiceEvtMsg', handleTalkingVoiceUser);
RedisPubSub.on('UserMutedVoiceEvtMsg', handleMutedVoiceUser);
RedisPubSub.on('GetVoiceUsersMeetingRespMsg', handleGetVoiceUsers);
RedisPubSub.on('GetVoiceUsersMeetingRespMsg', skipFlashDirectEvent(handleGetVoiceUsers));

View File

@ -1,6 +1,7 @@
import RedisPubSub from '/imports/startup/server/redis';
import { skipFlashDirectEvent } from '/imports/api/common/server/helpers';
import handleGetWhiteboardAccess from './handlers/getWhiteboardAccess';
RedisPubSub.on('GetWhiteboardAccessRespMsg', handleGetWhiteboardAccess);
RedisPubSub.on('GetWhiteboardAccessRespMsg', skipFlashDirectEvent(handleGetWhiteboardAccess));
RedisPubSub.on('SyncGetWhiteboardAccessRespMsg', handleGetWhiteboardAccess);
RedisPubSub.on('ModifyWhiteboardAccessEvtMsg', handleGetWhiteboardAccess);