vani-meeting-server 3.0.2 → 3.0.4-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,7 +10,7 @@ class BaseSFUWebsocket {
|
|
|
10
10
|
RedisHandler_1.RedisHandler.getInstance().redisPublisher.publish(topic, stringifyData);
|
|
11
11
|
if (data.interfaceName !== 'MultiSystemEventsBody') {
|
|
12
12
|
EventEmitterHandler_1.EventEmitterHandler.getInstance().vaniEventEmitter.emit(topic, stringifyData);
|
|
13
|
-
console.log("Message sent",
|
|
13
|
+
// console.log("Message sent",topic,stringifyData)
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
//Utilility function
|
|
@@ -39,7 +39,8 @@ export declare class RedisHandler {
|
|
|
39
39
|
removeParticipantForRoom(roomId: string, participant: Participant): Promise<undefined>;
|
|
40
40
|
addUpdateParticipantForRoom(roomId: string, participant: Participant): Promise<undefined>;
|
|
41
41
|
getParticipantByUserId(roomId: string, userId: string): Promise<Participant | undefined>;
|
|
42
|
-
|
|
42
|
+
private getAllParticipantsFromRedis;
|
|
43
|
+
getAllParticipants(roomId: string): Promise<Participant[]>;
|
|
43
44
|
getAllRoomsId(): Promise<string[] | undefined>;
|
|
44
45
|
private updateRoomCleanupTimeOut;
|
|
45
46
|
releaseRedis: () => Promise<void>;
|
|
@@ -201,8 +201,8 @@ class RedisHandler {
|
|
|
201
201
|
};
|
|
202
202
|
storeKeyValueForLocalCacheFromOtherServer = async (data) => {
|
|
203
203
|
try {
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
// ServerHandler.getInstance().serverStartRequest && ServerHandler.getInstance().serverStartRequest.logLevel !== LogLevel.None
|
|
205
|
+
// && console.log("storeKeyValueForLocalCacheFromOtherServer recived ", data)
|
|
206
206
|
if (data.senderIp !== await Constant_1.default.getPublicIp()) {
|
|
207
207
|
const key = data.data?.key;
|
|
208
208
|
const fieldOne = data.data?.fieldOne;
|
|
@@ -211,8 +211,8 @@ class RedisHandler {
|
|
|
211
211
|
let keyData = this.localCacheDataStorage.get(key);
|
|
212
212
|
if (keyData && fieldOne && fieldTwo) {
|
|
213
213
|
keyData.set(fieldOne, fieldTwo);
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
// ServerHandler.getInstance().serverStartRequest && ServerHandler.getInstance().serverStartRequest.logLevel !== LogLevel.None
|
|
215
|
+
// && console.log("storeKeyValueForLocalCacheFromOtherServer set ", keyData)
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
}
|
|
@@ -394,34 +394,49 @@ class RedisHandler {
|
|
|
394
394
|
return undefined;
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
async
|
|
397
|
+
async getAllParticipantsFromRedis(roomId) {
|
|
398
|
+
const particpantsInStringify = await this.redisClient.hGetAll(roomId);
|
|
399
|
+
const participants = [];
|
|
400
|
+
if (particpantsInStringify) {
|
|
401
|
+
console.log("getAllParticipantsFromRedis getAllParticipantsFromRedis ", particpantsInStringify);
|
|
402
|
+
Object.entries(particpantsInStringify).forEach(([key, value]) => {
|
|
403
|
+
console.log("getAllParticipantsFromRedis key ", key);
|
|
404
|
+
if (key.includes(RedisKeyType.Participants)) {
|
|
405
|
+
const valueStr = value;
|
|
406
|
+
participants.push(Object.assign(new Participant_1.Participant(), JSON.parse(valueStr)));
|
|
407
|
+
console.log("getAllParticipantsFromRedis key ", valueStr);
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
return participants;
|
|
412
|
+
}
|
|
413
|
+
async getAllParticipants(roomId) {
|
|
398
414
|
let particpantsInStringify;
|
|
399
415
|
try {
|
|
400
416
|
try {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
console.log("getAllParticipants from cache", particpantsInStringify, canFetchFromLocal);
|
|
406
|
-
}
|
|
417
|
+
const localCacheMessages = this.getKeyValueForLocalCache(roomId);
|
|
418
|
+
if (localCacheMessages) {
|
|
419
|
+
particpantsInStringify = localCacheMessages;
|
|
420
|
+
console.log("getAllParticipants from cache", particpantsInStringify);
|
|
407
421
|
}
|
|
408
422
|
}
|
|
409
423
|
catch (err) {
|
|
410
424
|
}
|
|
411
|
-
if (!particpantsInStringify) {
|
|
412
|
-
particpantsInStringify = await this.redisClient.hGetAll(roomId);
|
|
413
|
-
}
|
|
414
425
|
const participants = [];
|
|
415
426
|
if (particpantsInStringify) {
|
|
416
|
-
|
|
427
|
+
console.log("getAllParticipants particpantsInStringify ", particpantsInStringify);
|
|
428
|
+
const keysArray = [...particpantsInStringify.keys()];
|
|
429
|
+
keysArray.forEach((key) => {
|
|
430
|
+
console.log("getAllParticipants key ", key);
|
|
417
431
|
if (key.includes(RedisKeyType.Participants)) {
|
|
418
|
-
const valueStr =
|
|
432
|
+
const valueStr = particpantsInStringify.get(key);
|
|
419
433
|
participants.push(Object.assign(new Participant_1.Participant(), JSON.parse(valueStr)));
|
|
434
|
+
console.log("getAllParticipants key ", valueStr);
|
|
420
435
|
}
|
|
421
436
|
});
|
|
422
437
|
}
|
|
423
|
-
if (participants.length
|
|
424
|
-
return this.
|
|
438
|
+
if (participants.length < 2) {
|
|
439
|
+
return await this.getAllParticipantsFromRedis(roomId);
|
|
425
440
|
}
|
|
426
441
|
return participants;
|
|
427
442
|
}
|