vani-meeting-server 1.5.6 → 1.5.8

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.
@@ -1,4 +1,5 @@
1
1
  import { RedisHandler } from "./lib/redis/RedisHandler";
2
+ import { Participant } from "./models/Participant";
2
3
  import { WebSocketServerStartRequest } from "./models/WebSocketServerStartRequest";
3
4
  import { SFUHandler } from "./sfu/SFUHandler";
4
5
  import { WebSocketHandler } from "./websocket/WebSocketHandler";
@@ -28,4 +29,5 @@ export declare class ServerHandler {
28
29
  startPlainTransportForBroadcasting(plainTransportPayload: PlainTransportPayload, forRoomid: string): Promise<void>;
29
30
  resumePlainTransportForBroadcasting(forRoomid: string): Promise<void>;
30
31
  getAllOnGoingMeetingRoomIds(): Promise<string[] | undefined>;
32
+ getAllParticipatnsForRoomId(roomId: string): Promise<Participant[]>;
31
33
  }
@@ -38,5 +38,8 @@ class ServerHandler {
38
38
  async getAllOnGoingMeetingRoomIds() {
39
39
  return await this.rediHandler?.getAllRoomsId();
40
40
  }
41
+ async getAllParticipatnsForRoomId(roomId) {
42
+ return await RedisHandler_1.RedisHandler.getInstance().getAllParticipants(roomId);
43
+ }
41
44
  }
42
45
  exports.ServerHandler = ServerHandler;
@@ -367,7 +367,11 @@ class SFUEachRoomUserHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
367
367
  }
368
368
  const dtlsParameters = payload.message.dtlsParameters;
369
369
  if (transport) {
370
- await transport.connect({ dtlsParameters });
370
+ try {
371
+ await transport.connect({ dtlsParameters });
372
+ }
373
+ catch (err) {
374
+ }
371
375
  this.redisBroadcastMessageToTopic(this.selfParticipant.userId, this.preapreClientMessageBody(true, this.selfParticipant, this.preapreWebSocketMessageBody(EachSocketConnectionHandler_1.SFUMessageType.OnTransportConnectDone, { transportId: transport.id })));
372
376
  }
373
377
  else {
@@ -90,6 +90,7 @@ export declare class EachSocketConnectionHandler extends BaseSFUWebsocket {
90
90
  private selfParticipant?;
91
91
  private appId;
92
92
  private isActive;
93
+ private isUserJoinedFromAnotherSocket;
93
94
  private roomIds;
94
95
  private redisSubscribtionDetails;
95
96
  private isReconnectionFromUrl;
@@ -88,6 +88,7 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
88
88
  selfParticipant;
89
89
  appId = 'Demo';
90
90
  isActive = false;
91
+ isUserJoinedFromAnotherSocket = false;
91
92
  roomIds = [];
92
93
  redisSubscribtionDetails = [];
93
94
  isReconnectionFromUrl = false;
@@ -194,6 +195,7 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
194
195
  }
195
196
  else if (paylod.type === WebSocketBasicEvents.UpdateParticipant) {
196
197
  this.selfParticipant = paylod.data;
198
+ console.log(" WebSocketBasicEvents.UpdateParticipant", this.selfParticipant);
197
199
  RedisHandler_1.RedisHandler.getInstance().addUpdateParticipantForRoom(this.selfParticipant.roomId, this.selfParticipant);
198
200
  this.redisBroadcastMessageToTopic(this.selfParticipant.roomId, this.preapreClientMessageBody(true, this.selfParticipant, this.preapreWebSocketMessageBody(WebSocketBasicEvents.OnParticipantUpdated, this.selfParticipant)));
199
201
  }
@@ -317,11 +319,11 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
317
319
  this.redisBroadcastMessageToTopic(this.selfParticipant.userId, this.preapreClientMessageBody(true, this.selfParticipant, this.preapreWebSocketMessageBody(WebSocketBasicEvents.OnServerParticipants, userMap)));
318
320
  }
319
321
  startPingPong() {
320
- if (this.isActive && this.socket.OPEN && this.selfParticipant) {
321
- if (this.numberOfPongWaiting > 10) {
322
- console.log("No Pong More Than 10 Times start");
322
+ if (this.isUserJoinedFromAnotherSocket === false && this.selfParticipant) {
323
+ if (this.numberOfPongWaiting > 8) {
324
+ console.log("No Pong More Than 8 Times start");
323
325
  console.log(this.selfParticipant);
324
- console.log("No Pong More Than 10 Times End");
326
+ console.log("No Pong More Than 8 Times End");
325
327
  // isUserLeftMsgSent = true;
326
328
  this.onUserLeft();
327
329
  return;
@@ -360,6 +362,7 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
360
362
  const userId = data.userId;
361
363
  if (userId === this.selfParticipant?.userId && this.uuid !== senderUUID && this.roomIds.includes(roomId)) {
362
364
  this.isActive = false;
365
+ this.isUserJoinedFromAnotherSocket = true;
363
366
  this.socket.close(3006);
364
367
  this.cleanUp();
365
368
  console.log("onNewUserJoinedRoomWithSameUserId done");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-server",
3
- "version": "1.5.6",
3
+ "version": "1.5.8",
4
4
  "description": "Vani Meeting Server SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",