vani-meeting-server 1.6.1 → 1.6.2
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);
|
|
@@ -321,8 +323,9 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
|
|
|
321
323
|
this.redisBroadcastMessageToTopic(this.selfParticipant.userId, this.preapreClientMessageBody(true, this.selfParticipant, this.preapreWebSocketMessageBody(WebSocketBasicEvents.OnServerParticipants, userMap)));
|
|
322
324
|
}
|
|
323
325
|
async startPingPong() {
|
|
326
|
+
this.pingPongTimeout = undefined;
|
|
324
327
|
if (this.isUserJoinedFromAnotherSocket === false && this.selfParticipant && this.selfParticipant.roomId && this.selfParticipant.userId) {
|
|
325
|
-
if (this.numberOfPongWaiting >
|
|
328
|
+
if (this.numberOfPongWaiting > 10) {
|
|
326
329
|
console.log("No Pong More Than 8 Times start");
|
|
327
330
|
console.log(this.selfParticipant);
|
|
328
331
|
console.log("No Pong More Than 8 Times End");
|
|
@@ -331,11 +334,11 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
|
|
|
331
334
|
return;
|
|
332
335
|
}
|
|
333
336
|
const user = await RedisHandler_1.RedisHandler.getInstance().getParticipantByUserId(this.selfParticipant.roomId, this.selfParticipant.userId);
|
|
334
|
-
if (user) {
|
|
337
|
+
if (this.pingPongTimeout === undefined && user) {
|
|
335
338
|
this.redisBroadcastMessageToTopic(this.selfParticipant.userId, this.preapreClientMessageBody(true, this.selfParticipant, this.preapreWebSocketMessageBody(WebSocketBasicEvents.Ping, { userId: this.selfParticipant.userId })));
|
|
336
339
|
this.numberOfPongWaiting = this.numberOfPongWaiting + 1;
|
|
337
340
|
console.log("Pong", this.numberOfPongWaiting);
|
|
338
|
-
setTimeout(this.startPingPong, 5000);
|
|
341
|
+
this.pingPongTimeout = setTimeout(this.startPingPong, 5000);
|
|
339
342
|
}
|
|
340
343
|
}
|
|
341
344
|
}
|