vani-meeting-server 1.5.9 → 1.6.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.
@@ -163,6 +163,7 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
163
163
  this.onUserLeft();
164
164
  }
165
165
  else if (paylod.type === WebSocketBasicEvents.Pong) {
166
+ console.log(paylod, this.numberOfPongWaiting);
166
167
  this.numberOfPongWaiting = 0;
167
168
  }
168
169
  else if (paylod.type === WebSocketBasicEvents.GetMeetingStartTime) {
@@ -319,8 +320,8 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
319
320
  });
320
321
  this.redisBroadcastMessageToTopic(this.selfParticipant.userId, this.preapreClientMessageBody(true, this.selfParticipant, this.preapreWebSocketMessageBody(WebSocketBasicEvents.OnServerParticipants, userMap)));
321
322
  }
322
- startPingPong() {
323
- if (this.isUserJoinedFromAnotherSocket === false && this.selfParticipant) {
323
+ async startPingPong() {
324
+ if (this.isUserJoinedFromAnotherSocket === false && this.selfParticipant && this.selfParticipant.roomId && this.selfParticipant.userId) {
324
325
  if (this.numberOfPongWaiting > 8) {
325
326
  console.log("No Pong More Than 8 Times start");
326
327
  console.log(this.selfParticipant);
@@ -329,9 +330,13 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
329
330
  this.onUserLeft();
330
331
  return;
331
332
  }
332
- this.redisBroadcastMessageToTopic(this.selfParticipant.userId, this.preapreClientMessageBody(true, this.selfParticipant, this.preapreWebSocketMessageBody(WebSocketBasicEvents.Ping, { userId: this.selfParticipant.userId })));
333
- this.numberOfPongWaiting = this.numberOfPongWaiting + 1;
334
- setTimeout(this.startPingPong, 5000);
333
+ const user = await RedisHandler_1.RedisHandler.getInstance().getParticipantByUserId(this.selfParticipant.roomId, this.selfParticipant.userId);
334
+ if (user) {
335
+ this.redisBroadcastMessageToTopic(this.selfParticipant.userId, this.preapreClientMessageBody(true, this.selfParticipant, this.preapreWebSocketMessageBody(WebSocketBasicEvents.Ping, { userId: this.selfParticipant.userId })));
336
+ this.numberOfPongWaiting = this.numberOfPongWaiting + 1;
337
+ console.log("Pong", this.numberOfPongWaiting);
338
+ setTimeout(this.startPingPong, 5000);
339
+ }
335
340
  }
336
341
  }
337
342
  cleanUp() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-server",
3
- "version": "1.5.9",
3
+ "version": "1.6.1",
4
4
  "description": "Vani Meeting Server SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",