vani-meeting-server 1.6.1 → 1.6.3

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.
@@ -95,6 +95,7 @@ export declare class EachSocketConnectionHandler extends BaseSFUWebsocket {
95
95
  private redisSubscribtionDetails;
96
96
  private isReconnectionFromUrl;
97
97
  private numberOfPongWaiting;
98
+ private pingPongTimeout;
98
99
  private destoryCallback?;
99
100
  private connectionProtocol;
100
101
  constructor(socket: WebSocket.WebSocket, isReconnectionFromUrl: boolean);
@@ -93,6 +93,7 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
93
93
  redisSubscribtionDetails = [];
94
94
  isReconnectionFromUrl = false;
95
95
  numberOfPongWaiting = 0;
96
+ pingPongTimeout = undefined;
96
97
  destoryCallback;
97
98
  connectionProtocol = ServerHandler_1.ServerHandler.getInstance().serverStartRequest.connectionProtocol;
98
99
  constructor(socket, isReconnectionFromUrl) {
@@ -149,6 +150,7 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
149
150
  this.cleanUp();
150
151
  }
151
152
  async onNewMessage(msgData) {
153
+ this.numberOfPongWaiting = 0;
152
154
  const paylod = JSON.parse(msgData);
153
155
  if (paylod.type === WebSocketBasicEvents.Config) {
154
156
  this.onConfig(paylod.data);
@@ -163,7 +165,6 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
163
165
  this.onUserLeft();
164
166
  }
165
167
  else if (paylod.type === WebSocketBasicEvents.Pong) {
166
- console.log(paylod, this.numberOfPongWaiting);
167
168
  this.numberOfPongWaiting = 0;
168
169
  }
169
170
  else if (paylod.type === WebSocketBasicEvents.GetMeetingStartTime) {
@@ -321,8 +322,9 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
321
322
  this.redisBroadcastMessageToTopic(this.selfParticipant.userId, this.preapreClientMessageBody(true, this.selfParticipant, this.preapreWebSocketMessageBody(WebSocketBasicEvents.OnServerParticipants, userMap)));
322
323
  }
323
324
  async startPingPong() {
325
+ this.pingPongTimeout = undefined;
324
326
  if (this.isUserJoinedFromAnotherSocket === false && this.selfParticipant && this.selfParticipant.roomId && this.selfParticipant.userId) {
325
- if (this.numberOfPongWaiting > 8) {
327
+ if (this.numberOfPongWaiting > 10) {
326
328
  console.log("No Pong More Than 8 Times start");
327
329
  console.log(this.selfParticipant);
328
330
  console.log("No Pong More Than 8 Times End");
@@ -331,11 +333,10 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
331
333
  return;
332
334
  }
333
335
  const user = await RedisHandler_1.RedisHandler.getInstance().getParticipantByUserId(this.selfParticipant.roomId, this.selfParticipant.userId);
334
- if (user) {
336
+ if (this.pingPongTimeout === undefined && user) {
335
337
  this.redisBroadcastMessageToTopic(this.selfParticipant.userId, this.preapreClientMessageBody(true, this.selfParticipant, this.preapreWebSocketMessageBody(WebSocketBasicEvents.Ping, { userId: this.selfParticipant.userId })));
336
338
  this.numberOfPongWaiting = this.numberOfPongWaiting + 1;
337
- console.log("Pong", this.numberOfPongWaiting);
338
- setTimeout(this.startPingPong, 5000);
339
+ this.pingPongTimeout = setTimeout(this.startPingPong, 5000);
339
340
  }
340
341
  }
341
342
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-server",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "Vani Meeting Server SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",