vani-meeting-server 1.5.7 → 1.5.9

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;
@@ -1,4 +1,5 @@
1
1
  import { PlainTransportCreatedCallback } from "../ServerHandler";
2
+ import { WebSocketMessageBody } from "../websocket/EachSocketConnectionHandler";
2
3
  import { Logs } from "./Logs";
3
4
  import { Participant } from "./Participant";
4
5
  export declare enum VaniEvent {
@@ -9,7 +10,8 @@ export declare enum VaniEvent {
9
10
  OnServerStarted = "onServerStarted",
10
11
  OnPlainTransportCreated = "onPlainTransportCreated",
11
12
  OnPlainTransportCreateError = "onPlainTransportCreateError",
12
- OnLog = "OnLog"
13
+ OnLog = "OnLog",
14
+ OnNewChatMessageReceived = "OnNewChatMessageReceived"
13
15
  }
14
16
  interface VaniConnectionEvents {
15
17
  [VaniEvent.OnNewMeetingStarted]: (roomId: string) => any;
@@ -20,6 +22,7 @@ interface VaniConnectionEvents {
20
22
  [VaniEvent.OnPlainTransportCreated]: (plainTransportCreatedCallback: PlainTransportCreatedCallback) => any;
21
23
  [VaniEvent.OnPlainTransportCreateError]: (plainTransportCreatedCallback: PlainTransportCreatedCallback) => any;
22
24
  [VaniEvent.OnLog]: (log: Logs) => any;
25
+ [VaniEvent.OnNewChatMessageReceived]: (payload: WebSocketMessageBody) => any;
23
26
  }
24
27
  export declare interface VaniEventListener {
25
28
  on<U extends keyof VaniConnectionEvents>(event: U, listener: VaniConnectionEvents[U]): this;
@@ -11,4 +11,5 @@ var VaniEvent;
11
11
  VaniEvent["OnPlainTransportCreated"] = "onPlainTransportCreated";
12
12
  VaniEvent["OnPlainTransportCreateError"] = "onPlainTransportCreateError";
13
13
  VaniEvent["OnLog"] = "OnLog";
14
+ VaniEvent["OnNewChatMessageReceived"] = "OnNewChatMessageReceived";
14
15
  })(VaniEvent = exports.VaniEvent || (exports.VaniEvent = {}));
@@ -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;
@@ -207,6 +208,7 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
207
208
  if (paylod.type !== WebSocketBasicEvents.Pong && paylod.type !== SFUMessageType.SFUMessage) {
208
209
  Utility_1.Utility.checkAndSendLogs({ logLevel: WebSocketServerStartRequest_1.LogLevel.Info, roomId: this.selfParticipant?.roomId, payload: paylod, logType: Logs_1.LogType.LogTypeWSS });
209
210
  }
211
+ this.sendVaniEvent(Event_1.VaniEvent.OnNewChatMessageReceived, paylod);
210
212
  }
211
213
  async onAudioVideoPauseResume(data) {
212
214
  if (this.selfParticipant) {
@@ -318,11 +320,11 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
318
320
  this.redisBroadcastMessageToTopic(this.selfParticipant.userId, this.preapreClientMessageBody(true, this.selfParticipant, this.preapreWebSocketMessageBody(WebSocketBasicEvents.OnServerParticipants, userMap)));
319
321
  }
320
322
  startPingPong() {
321
- if (this.isActive && this.socket.OPEN && this.selfParticipant) {
322
- if (this.numberOfPongWaiting > 10) {
323
- console.log("No Pong More Than 10 Times start");
323
+ if (this.isUserJoinedFromAnotherSocket === false && this.selfParticipant) {
324
+ if (this.numberOfPongWaiting > 8) {
325
+ console.log("No Pong More Than 8 Times start");
324
326
  console.log(this.selfParticipant);
325
- console.log("No Pong More Than 10 Times End");
327
+ console.log("No Pong More Than 8 Times End");
326
328
  // isUserLeftMsgSent = true;
327
329
  this.onUserLeft();
328
330
  return;
@@ -361,6 +363,7 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
361
363
  const userId = data.userId;
362
364
  if (userId === this.selfParticipant?.userId && this.uuid !== senderUUID && this.roomIds.includes(roomId)) {
363
365
  this.isActive = false;
366
+ this.isUserJoinedFromAnotherSocket = true;
364
367
  this.socket.close(3006);
365
368
  this.cleanUp();
366
369
  console.log("onNewUserJoinedRoomWithSameUserId done");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-server",
3
- "version": "1.5.7",
3
+ "version": "1.5.9",
4
4
  "description": "Vani Meeting Server SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",