vani-meeting-server 2.9.2 → 2.9.4

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.
@@ -12,6 +12,7 @@ const SFUHandler_1 = require("./sfu/SFUHandler");
12
12
  const EachSocketConnectionHandler_1 = require("./websocket/EachSocketConnectionHandler");
13
13
  const WebSocketHandler_1 = require("./websocket/WebSocketHandler");
14
14
  const uuid_1 = require("uuid");
15
+ const Utility_1 = require("./utility/Utility");
15
16
  class ServerHandler {
16
17
  serverStartRequest = new WebSocketServerStartRequest_1.WebSocketServerStartRequest();
17
18
  rediHandler;
@@ -117,6 +118,7 @@ class ServerHandler {
117
118
  }
118
119
  catch (err) {
119
120
  this.serverStartRequest && this.serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("closeTheRoomForcefully", err);
121
+ Utility_1.Utility.sendVaniError(err);
120
122
  }
121
123
  };
122
124
  }
@@ -9,6 +9,7 @@ const Participant_1 = require("../../models/Participant");
9
9
  const ServerHandler_1 = require("../../ServerHandler");
10
10
  const Constant_1 = __importDefault(require("../../utility/Constant"));
11
11
  const WebSocketServerStartRequest_1 = require("../../models/WebSocketServerStartRequest");
12
+ const Utility_1 = require("../../utility/Utility");
12
13
  const EachSocketConnectionHandler_1 = require("../../websocket/EachSocketConnectionHandler");
13
14
  var RedisKeyType;
14
15
  (function (RedisKeyType) {
@@ -39,6 +40,7 @@ class RedisHandler {
39
40
  }
40
41
  catch (err) {
41
42
  console.log("init", err);
43
+ Utility_1.Utility.sendVaniError(err);
42
44
  }
43
45
  }
44
46
  isRedisConnected = async () => {
@@ -51,6 +53,7 @@ class RedisHandler {
51
53
  }
52
54
  catch (err) {
53
55
  console.log("isRedisConnected", false, err);
56
+ Utility_1.Utility.sendVaniError(err);
54
57
  return false;
55
58
  }
56
59
  return false;
@@ -83,6 +86,7 @@ class RedisHandler {
83
86
  this.localEventUpdateRedisSubsciption = { listener: listener, topic: EachSocketConnectionHandler_1.MultiSystemEvents.SyncLocalEvent };
84
87
  }
85
88
  catch (err) {
89
+ Utility_1.Utility.sendVaniError(err);
86
90
  }
87
91
  });
88
92
  this.redisSubscriber.on('end', (err) => {
@@ -93,6 +97,7 @@ class RedisHandler {
93
97
  }
94
98
  }
95
99
  catch (err) {
100
+ Utility_1.Utility.sendVaniError(err);
96
101
  }
97
102
  console.log('redisSubscriber Redis connection has been closed.', err);
98
103
  });
@@ -104,6 +109,7 @@ class RedisHandler {
104
109
  }
105
110
  }
106
111
  catch (err) {
112
+ Utility_1.Utility.sendVaniError(err);
107
113
  }
108
114
  console.log('redisSubscriber Unknown exception occurred at Redis', err);
109
115
  });
@@ -123,6 +129,7 @@ class RedisHandler {
123
129
  await this.redisPublisher.connect();
124
130
  }
125
131
  catch (err) {
132
+ Utility_1.Utility.sendVaniError(err);
126
133
  console.log("connectDB", err);
127
134
  }
128
135
  // await this.redisClient.hSet("rooms","123","HSETObject")
@@ -137,6 +144,7 @@ class RedisHandler {
137
144
  }
138
145
  catch (err) {
139
146
  // console.log("cleanUp", err)
147
+ Utility_1.Utility.sendVaniError(err);
140
148
  }
141
149
  }
142
150
  //Clean Room Id
@@ -148,6 +156,7 @@ class RedisHandler {
148
156
  }
149
157
  catch (err) {
150
158
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("cleanUpRoomId", err);
159
+ Utility_1.Utility.sendVaniError(err);
151
160
  }
152
161
  }
153
162
  //ip addresss
@@ -180,6 +189,7 @@ class RedisHandler {
180
189
  await this.redisBroadcastMessageToTopic(EachSocketConnectionHandler_1.MultiSystemEvents.SyncLocalEvent, { senderIp: (await Constant_1.default.getPublicIp()).toString(), data: { key: key, fieldOne: fieldOne, fieldTwo: fieldTwo }, interfaceName: 'SyncLocalEvent', type: EachSocketConnectionHandler_1.MultiSystemEvents.SyncLocalEvent });
181
190
  }
182
191
  catch (err) {
192
+ Utility_1.Utility.sendVaniError(err);
183
193
  }
184
194
  keyData.set(fieldOne, fieldTwo);
185
195
  };
@@ -202,6 +212,7 @@ class RedisHandler {
202
212
  }
203
213
  }
204
214
  catch (err) {
215
+ Utility_1.Utility.sendVaniError(err);
205
216
  }
206
217
  };
207
218
  redisBroadcastMessageToTopic = async (topic, data) => {
@@ -224,6 +235,7 @@ class RedisHandler {
224
235
  }
225
236
  catch (err) {
226
237
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("setIpForRoomId", err);
238
+ Utility_1.Utility.sendVaniError(err);
227
239
  }
228
240
  }
229
241
  async fetchIpsForRoomId(roomId) {
@@ -244,6 +256,7 @@ class RedisHandler {
244
256
  }
245
257
  catch (err) {
246
258
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("fetchIpsForRoomId", err);
259
+ Utility_1.Utility.sendVaniError(err);
247
260
  return [];
248
261
  }
249
262
  }
@@ -257,6 +270,7 @@ class RedisHandler {
257
270
  }
258
271
  catch (err) {
259
272
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("deleteIpForRoomId", err);
273
+ Utility_1.Utility.sendVaniError(err);
260
274
  }
261
275
  }
262
276
  //Messages
@@ -269,6 +283,7 @@ class RedisHandler {
269
283
  this.updateRoomCleanupTimeOut(roomId);
270
284
  }
271
285
  catch (err) {
286
+ Utility_1.Utility.sendVaniError(err);
272
287
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("storeMesagesForRoom", err);
273
288
  }
274
289
  }
@@ -284,6 +299,7 @@ class RedisHandler {
284
299
  }
285
300
  }
286
301
  catch (err) {
302
+ Utility_1.Utility.sendVaniError(err);
287
303
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("fetchMessagesForRoom", err);
288
304
  return [];
289
305
  }
@@ -296,6 +312,7 @@ class RedisHandler {
296
312
  this.updateRoomCleanupTimeOut(roomId);
297
313
  }
298
314
  catch (err) {
315
+ Utility_1.Utility.sendVaniError(err);
299
316
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("storeMeetingTimeForRoom", err);
300
317
  return undefined;
301
318
  }
@@ -312,6 +329,7 @@ class RedisHandler {
312
329
  }
313
330
  }
314
331
  catch (err) {
332
+ Utility_1.Utility.sendVaniError(err);
315
333
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("fetchMeetingTimeForRoom", err);
316
334
  return undefined;
317
335
  }
@@ -329,6 +347,7 @@ class RedisHandler {
329
347
  this.updateRoomCleanupTimeOut(roomId);
330
348
  }
331
349
  catch (err) {
350
+ Utility_1.Utility.sendVaniError(err);
332
351
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("removeParticipantForRoom", err);
333
352
  return undefined;
334
353
  }
@@ -348,6 +367,7 @@ class RedisHandler {
348
367
  this.updateRoomCleanupTimeOut(roomId);
349
368
  }
350
369
  catch (err) {
370
+ Utility_1.Utility.sendVaniError(err);
351
371
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("addUpdateParticipantForRoom", err);
352
372
  return undefined;
353
373
  }
@@ -363,6 +383,7 @@ class RedisHandler {
363
383
  return undefined;
364
384
  }
365
385
  catch (err) {
386
+ Utility_1.Utility.sendVaniError(err);
366
387
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("getParticipantByUserId", err);
367
388
  return undefined;
368
389
  }
@@ -382,6 +403,7 @@ class RedisHandler {
382
403
  return participants;
383
404
  }
384
405
  catch (err) {
406
+ Utility_1.Utility.sendVaniError(err);
385
407
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("getAllParticipants", err);
386
408
  return [];
387
409
  }
@@ -392,6 +414,7 @@ class RedisHandler {
392
414
  return await this.redisClient.keys("*");
393
415
  }
394
416
  catch (err) {
417
+ Utility_1.Utility.sendVaniError(err);
395
418
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("getAllRoomsId", err);
396
419
  }
397
420
  }
@@ -416,6 +439,7 @@ class RedisHandler {
416
439
  this.cleanupLocalCache();
417
440
  }
418
441
  catch (e) {
442
+ Utility_1.Utility.sendVaniError(e);
419
443
  }
420
444
  }
421
445
  releaseRedis = async () => {
@@ -431,7 +455,9 @@ class RedisHandler {
431
455
  this.localCacheDataStorage = new Map();
432
456
  }
433
457
  }
434
- catch (err) { }
458
+ catch (err) {
459
+ Utility_1.Utility.sendVaniError(err);
460
+ }
435
461
  };
436
462
  }
437
463
  exports.RedisHandler = RedisHandler;
@@ -10,6 +10,7 @@ export declare enum VaniEvent {
10
10
  OnAllParticipantLeftOnServer = "OnAllParticipantLeftOnServer",
11
11
  OnUserJoined = "onUserJoined",
12
12
  OnUserLeft = "onUserLeft",
13
+ OnError = "onError",
13
14
  OnServerStarted = "onServerStarted",
14
15
  OnPlainTransportCreated = "onPlainTransportCreated",
15
16
  OnPlainTransportCreateError = "onPlainTransportCreateError",
@@ -27,6 +28,7 @@ interface VaniConnectionEvents {
27
28
  [VaniEvent.OnUserJoined]: (participant: Participant) => any;
28
29
  [VaniEvent.OnLocalRedisMessage]: (message: any) => any;
29
30
  [VaniEvent.OnUserLeft]: (participant: Participant) => any;
31
+ [VaniEvent.OnError]: (error: Error) => any;
30
32
  [VaniEvent.OnServerStarted]: () => any;
31
33
  [VaniEvent.OnPlainTransportCreated]: (plainTransportCreatedCallback: PlainTransportCreatedCallback) => any;
32
34
  [VaniEvent.OnPlainTransportCreateError]: (plainTransportCreatedCallback: PlainTransportCreatedCallback) => any;
@@ -10,6 +10,7 @@ var VaniEvent;
10
10
  VaniEvent["OnAllParticipantLeftOnServer"] = "OnAllParticipantLeftOnServer";
11
11
  VaniEvent["OnUserJoined"] = "onUserJoined";
12
12
  VaniEvent["OnUserLeft"] = "onUserLeft";
13
+ VaniEvent["OnError"] = "onError";
13
14
  VaniEvent["OnServerStarted"] = "onServerStarted";
14
15
  VaniEvent["OnPlainTransportCreated"] = "onPlainTransportCreated";
15
16
  VaniEvent["OnPlainTransportCreateError"] = "onPlainTransportCreateError";
@@ -228,8 +228,8 @@ class SFUEachRoomHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
228
228
  Utility_1.Utility.checkAndSendLogs({ logLevel: WebSocketServerStartRequest_1.LogLevel.Warn, roomId: this.roomId, payload: errorPayload, logType: Logs_1.LogType.LogTypeError });
229
229
  // console.log("no send router found while creating recv router")
230
230
  }
231
- this.workers = undefined;
232
- this.sendWorkerIndex = -1;
231
+ // this.workers = undefined
232
+ // this.sendWorkerIndex = -1
233
233
  }
234
234
  async addAudioLevel() {
235
235
  if (this.sendRouter && !this.audioLevelObserver) {
@@ -325,6 +325,7 @@ class SFUEachRoomHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
325
325
  await this.sendRouter?.pipeToRouter({ producerId: producer.id, router: eachRecvRouter });
326
326
  }
327
327
  catch (err) {
328
+ Utility_1.Utility.sendVaniError(err);
328
329
  const errorPayload = { message: "Error While PipeToRoute - pipeToRoute - SFUEachRoomHandler", extraData: err };
329
330
  Utility_1.Utility.checkAndSendLogs({ logLevel: WebSocketServerStartRequest_1.LogLevel.Error, roomId: this.roomId, payload: errorPayload, logType: Logs_1.LogType.LogTypeError });
330
331
  }
@@ -337,6 +338,7 @@ class SFUEachRoomHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
337
338
  console.log("onNewProducer 411", producer, participant.userData);
338
339
  }
339
340
  catch (err) {
341
+ Utility_1.Utility.sendVaniError(err);
340
342
  }
341
343
  if (this.plainTransportPayload && this.plainTransportPayload.isAudioRequired && producer.kind === "audio") {
342
344
  await this.createPlainTransportAndConsumeProducer(this.plainTransportPayload, producer);
@@ -372,6 +374,7 @@ class SFUEachRoomHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
372
374
  eachConsumer.resume();
373
375
  }
374
376
  catch (err) {
377
+ Utility_1.Utility.sendVaniError(err);
375
378
  console.log("Error - Line no 447", err);
376
379
  }
377
380
  }
@@ -392,6 +395,7 @@ class SFUEachRoomHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
392
395
  await this.createPlainTransportAndConsumeProducer(plainTransportPayload, eachRoomProducer.producer);
393
396
  }
394
397
  catch (err) {
398
+ Utility_1.Utility.sendVaniError(err);
395
399
  }
396
400
  }
397
401
  else if (isVideoRequired && eachRoomProducer && eachRoomProducer.producer && eachRoomProducer.producer.kind === 'video') {
@@ -399,6 +403,7 @@ class SFUEachRoomHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
399
403
  await this.createPlainTransportAndConsumeProducer(plainTransportPayload, eachRoomProducer.producer);
400
404
  }
401
405
  catch (err) {
406
+ Utility_1.Utility.sendVaniError(err);
402
407
  }
403
408
  }
404
409
  }
@@ -481,6 +486,7 @@ class SFUEachRoomHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
481
486
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("consumeProducerForPlainTransport success 529", producer.appData, producer.type);
482
487
  }
483
488
  catch (err) {
489
+ Utility_1.Utility.sendVaniError(err);
484
490
  console.log("consumeProducerForPlainTransport ", err);
485
491
  }
486
492
  }
@@ -555,6 +561,7 @@ class SFUEachRoomHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
555
561
  eachPlainTransportsForBroadCasting.close();
556
562
  }
557
563
  catch (err) {
564
+ Utility_1.Utility.sendVaniError(err);
558
565
  }
559
566
  });
560
567
  this.plainTransportConsumers = [];
@@ -158,6 +158,7 @@ class SFUEachRoomUserHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
158
158
  }
159
159
  }
160
160
  catch (err) {
161
+ Utility_1.Utility.sendVaniError(err);
161
162
  const errorPayload = { message: "Product consume Error - onConsumeProductId - SFUEachRoomUserHandler", extraData: err };
162
163
  Utility_1.Utility.checkAndSendLogs({ logLevel: WebSocketServerStartRequest_1.LogLevel.Error, roomId: this.selfParticipant.roomId, payload: errorPayload, logType: Logs_1.LogType.LogTypeError });
163
164
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log(" Product Consume Error ", payload);
@@ -217,6 +218,7 @@ class SFUEachRoomUserHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
217
218
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("consumer.setPreferredLayers", spatialLayer);
218
219
  }
219
220
  catch (err) {
221
+ Utility_1.Utility.sendVaniError(err);
220
222
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log(err);
221
223
  }
222
224
  }
@@ -234,6 +236,7 @@ class SFUEachRoomUserHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
234
236
  this.onProducerClosed(sfuMessagePayload);
235
237
  }
236
238
  catch (err) {
239
+ Utility_1.Utility.sendVaniError(err);
237
240
  }
238
241
  });
239
242
  if (ServerHandler_1.ServerHandler.getInstance().serverStartRequest.shouldShareStreamScoreChange) {
@@ -331,6 +334,7 @@ class SFUEachRoomUserHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
331
334
  }
332
335
  }
333
336
  catch (err) {
337
+ Utility_1.Utility.sendVaniError(err);
334
338
  }
335
339
  if (!this.webrtcSendTransport || this.webrtcSendTransport.closed) {
336
340
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log("createWebrtcSendTransport started");
@@ -383,6 +387,7 @@ class SFUEachRoomUserHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
383
387
  }
384
388
  }
385
389
  catch (err) {
390
+ Utility_1.Utility.sendVaniError(err);
386
391
  }
387
392
  if (!this.webrtcRecieveTransport || this.webrtcRecieveTransport.closed) {
388
393
  const router = this.recvRouter ? this.recvRouter : this.sendRouter;
@@ -431,6 +436,7 @@ class SFUEachRoomUserHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
431
436
  await transport.connect({ dtlsParameters });
432
437
  }
433
438
  catch (err) {
439
+ Utility_1.Utility.sendVaniError(err);
434
440
  }
435
441
  this.redisBroadcastMessageToTopic(this.selfParticipant.userId, this.preapreClientMessageBody(true, this.selfParticipant, this.preapreWebSocketMessageBody(EachSocketConnectionHandler_1.SFUMessageType.OnTransportConnectDone, { transportId: transport.id })));
436
442
  }
@@ -474,6 +480,7 @@ class SFUEachRoomUserHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
474
480
  this.producers = this.producers.filter((eachProducer) => eachProducer.closed === false);
475
481
  }
476
482
  catch (err) {
483
+ Utility_1.Utility.sendVaniError(err);
477
484
  ServerHandler_1.ServerHandler.getInstance().serverStartRequest && ServerHandler_1.ServerHandler.getInstance().serverStartRequest.logLevel !== WebSocketServerStartRequest_1.LogLevel.None && console.log(err);
478
485
  }
479
486
  if (this.isUserPresentInRoom) {
@@ -2,4 +2,5 @@ import { Logs } from "../models/Logs";
2
2
  export declare class Utility {
3
3
  static checkAndSendLogs(log: Logs): Promise<void>;
4
4
  static getTopicForRoomIdAndIp(roomId: String, ipAddress: string): string;
5
+ static sendVaniError: (error: any) => Promise<void>;
5
6
  }
@@ -13,5 +13,13 @@ class Utility {
13
13
  static getTopicForRoomIdAndIp(roomId, ipAddress) {
14
14
  return roomId + "_" + ipAddress;
15
15
  }
16
+ static sendVaniError = async (error) => {
17
+ try {
18
+ EventEmitterHandler_1.EventEmitterHandler.getInstance().vaniEventEmitter.emit(Event_1.VaniEvent.OnError, error);
19
+ }
20
+ catch (e) {
21
+ Utility.sendVaniError(e);
22
+ }
23
+ };
16
24
  }
17
25
  exports.Utility = Utility;
@@ -403,6 +403,7 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
403
403
  this.socket.removeAllListeners();
404
404
  }
405
405
  catch (err) {
406
+ Utility_1.Utility.sendVaniError(err);
406
407
  }
407
408
  if (this.destoryCallback) {
408
409
  this.destoryCallback(this);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-server",
3
- "version": "2.9.2",
3
+ "version": "2.9.4",
4
4
  "description": "Vani Meeting Server SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",