aotrautils-srv 0.0.218 → 0.0.221

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,6 +1,6 @@
1
1
 
2
2
 
3
- /*utils COMMONS library associated with aotra version : «1.0.0.000 (19/07/2022-04:19:44)»*/
3
+ /*utils COMMONS library associated with aotra version : «1.0.0.000 (22/07/2022-00:54:19)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4828,7 +4828,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4828
4828
 
4829
4829
 
4830
4830
 
4831
- /*utils SERVER library associated with aotra version : «1.0.0.000 (19/07/2022-04:19:44)»*/
4831
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (22/07/2022-00:54:19)»*/
4832
4832
  /*-----------------------------------------------------------------------------*/
4833
4833
 
4834
4834
 
@@ -5347,7 +5347,6 @@ WebsocketImplementation={
5347
5347
  if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.terminate();
5348
5348
  else clientSocket.emit("endConnection");
5349
5349
 
5350
- // TODO : FIXME : DUPLICATED CODE :
5351
5350
  if(!empty(nodeServerInstance.onClientLostListeners))
5352
5351
  foreach(nodeServerInstance.onClientLostListeners,l=>{l.execute(clientSocket);});
5353
5352
 
@@ -5357,31 +5356,13 @@ WebsocketImplementation={
5357
5356
  }
5358
5357
 
5359
5358
  clientSocket.isConnectionAlive=false;
5360
- // try{
5361
5359
 
5362
- // OLD :
5363
- // if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.ping();
5364
- // else clientSocket.emit("ping");
5360
+ // OLD :
5361
+ // if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.ping();
5362
+ // else clientSocket.emit("ping");
5365
5363
 
5366
5364
  nodeServerInstance.send("protocol",{type:"ping"});
5367
5365
 
5368
-
5369
- // }catch(error){
5370
- // lognow("ERROR : A problem occurred when tried to ping client socket : ",error);
5371
- // // We effectively end the client connection to this server :
5372
- //
5373
- // // TODO : FIXME : DUPLICATED CODE :
5374
- // // TODO : FIXME : Use one single interface !
5375
- // if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.terminate();
5376
- // else clientSocket.emit("endConnection");
5377
- //
5378
- // // TODO : FIXME : DUPLICATED CODE :
5379
- // if(!empty(nodeServerInstance.onClientLostListeners))
5380
- // foreach(nodeServerInstance.onClientLostListeners,l=>{l.execute(clientSocket);});
5381
- //
5382
- // return;
5383
- // }
5384
-
5385
5366
 
5386
5367
  }, nodeServerInstance.clientTimeoutMillis);
5387
5368
 
@@ -5554,7 +5535,7 @@ WebsocketImplementation={
5554
5535
 
5555
5536
  send:(channelName, data, clientsRoomsTag=null)=>{
5556
5537
 
5557
- let clientSocket=nodeClientInstance.clientSocket;
5538
+ const clientSocket=nodeClientInstance.clientSocket;
5558
5539
 
5559
5540
 
5560
5541
  // // DBG
@@ -5606,15 +5587,19 @@ WebsocketImplementation={
5606
5587
  if(nodeClientInstance.hasConnectEventFired) return;
5607
5588
  nodeClientInstance.hasConnectEventFired=true;
5608
5589
 
5609
- let clientSocket=nodeClientInstance.clientSocket;
5590
+ const clientSocket=nodeClientInstance.clientSocket;
5591
+
5592
+ // DBG
5593
+ clientSocket.clientId=getUUID();
5610
5594
 
5611
5595
  doOnConnection(nodeClientInstance, clientSocket);
5612
5596
 
5613
- // We execute the listeners entry points:
5597
+ // We execute the listeners entry points registration :
5614
5598
  foreach(nodeClientInstance.receptionEntryPoints,(receptionEntryPoint)=>{
5615
5599
  receptionEntryPoint.execute(clientSocket);
5616
5600
  });
5617
5601
 
5602
+
5618
5603
  };
5619
5604
 
5620
5605
  if(!WebsocketImplementation.useSocketIOImplementation) nodeClientInstance.clientSocket.addEventListener("open",doAllOnConnection);
@@ -5714,7 +5699,7 @@ WebsocketImplementation={
5714
5699
 
5715
5700
  send:(channelName, data, clientsRoomsTag=null)=>{
5716
5701
 
5717
- let clientSocket=browserInstance.clientSocket;
5702
+ const clientSocket=browserInstance.clientSocket;
5718
5703
 
5719
5704
 
5720
5705
  // // DBG
@@ -5757,13 +5742,24 @@ WebsocketImplementation={
5757
5742
 
5758
5743
 
5759
5744
  onConnectionToServer:(doOnConnection)=>{
5745
+ const doAllOnConnection=()=>{
5746
+
5747
+ // To avoid triggering this event several times, depending on the implementation :
5748
+ if(browserInstance.hasConnectEventFired) return;
5749
+ browserInstance.hasConnectEventFired=true;
5750
+
5751
+ const clientSocket=browserInstance.clientSocket;
5752
+
5753
+ // DBG
5754
+ clientSocket.clientId=getUUID();
5755
+
5756
+ doOnConnection(browserInstance, clientSocket);
5757
+
5758
+
5759
+ };
5760
5760
 
5761
- // To avoid triggering this event several times, depending on the implementation :
5762
- if(browserInstance.hasConnectEventFired) return;
5763
- browserInstance.hasConnectEventFired=true;
5764
-
5765
- if(!WebsocketImplementation.useSocketIOImplementation) browserInstance.clientSocket.addEventListener("open",doOnConnection);
5766
- else browserInstance.clientSocket.on("connect",doOnConnection);
5761
+ if(!WebsocketImplementation.useSocketIOImplementation) browserInstance.clientSocket.addEventListener("open",doAllOnConnection);
5762
+ else browserInstance.clientSocket.on("connect",doAllOnConnection);
5767
5763
 
5768
5764
 
5769
5765
  },
@@ -6225,7 +6221,8 @@ class ListManager{
6225
6221
  if(!this.isSessionActive()) return false;
6226
6222
  const clientPosition=this.getItemPosition(clientId);
6227
6223
  //CAUTION : Client position starts at 1 !
6228
- const result=((clientPosition-1)<=this.maxItemsNumber && (clientPosition-1)<=this.simultaneousItemsNumber);
6224
+ const clientIndex=(clientPosition-1);
6225
+ const result=(clientIndex<=this.maxItemsNumber && clientIndex<=this.simultaneousItemsNumber);
6229
6226
 
6230
6227
  return result;
6231
6228
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.218",
3
+ "version": "0.0.221",
4
4
  "main": "aotrautils-srv.build.js",
5
5
  "description": "A library for vanilla javascript utils (server-side) used in aotra javascript CMS",
6
6
  "author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",