vani-meeting-server 3.0.0 → 3.0.1

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.
@@ -39,7 +39,7 @@ 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
- getAllParticipants(roomId: string): Promise<Participant[]>;
42
+ getAllParticipants(roomId: string, canFetchFromLocal?: boolean): Promise<Participant[]>;
43
43
  getAllRoomsId(): Promise<string[] | undefined>;
44
44
  private updateRoomCleanupTimeOut;
45
45
  releaseRedis: () => Promise<void>;
@@ -394,14 +394,16 @@ class RedisHandler {
394
394
  return undefined;
395
395
  }
396
396
  }
397
- async getAllParticipants(roomId) {
397
+ async getAllParticipants(roomId, canFetchFromLocal = true) {
398
398
  let particpantsInStringify;
399
399
  try {
400
400
  try {
401
- const localCacheMessages = this.getKeyValueForLocalCache(roomId);
402
- if (localCacheMessages) {
403
- particpantsInStringify = localCacheMessages;
404
- console.log("getAllParticipants from cache", particpantsInStringify);
401
+ if (canFetchFromLocal) {
402
+ const localCacheMessages = this.getKeyValueForLocalCache(roomId);
403
+ if (localCacheMessages) {
404
+ particpantsInStringify = localCacheMessages;
405
+ console.log("getAllParticipants from cache", particpantsInStringify, canFetchFromLocal);
406
+ }
405
407
  }
406
408
  }
407
409
  catch (err) {
@@ -418,6 +420,9 @@ class RedisHandler {
418
420
  }
419
421
  });
420
422
  }
423
+ if (participants.length === 0 && !canFetchFromLocal) {
424
+ return this.getAllParticipants(roomId, false);
425
+ }
421
426
  return participants;
422
427
  }
423
428
  catch (err) {
@@ -391,10 +391,12 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
391
391
  }
392
392
  async getAllParticipants() {
393
393
  const allUsers = await RedisHandler_1.RedisHandler.getInstance().getAllParticipants(this.selfParticipant?.roomId);
394
+ ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("getAllParticipants", allUsers);
394
395
  const userMap = {};
395
396
  allUsers.forEach((participant) => {
396
397
  userMap[participant.userId] = participant;
397
398
  });
399
+ ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("getAllParticipants usermao", userMap);
398
400
  this.redisBroadcastMessageToTopic(this.selfParticipant.userId, this.preapreClientMessageBody(true, this.selfParticipant, this.preapreWebSocketMessageBody(WebSocketBasicEvents.OnServerParticipants, userMap)));
399
401
  }
400
402
  async startPingPong() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-server",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Vani Meeting Server SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",