aotrautils-srv 0.0.217 → 0.0.220

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:10:29)»*/
3
+ /*utils COMMONS library associated with aotra version : «1.0.0.000 (22/07/2022-00:49:55)»*/
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:10:29)»*/
4831
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (22/07/2022-00:49:55)»*/
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
 
@@ -5610,11 +5591,17 @@ WebsocketImplementation={
5610
5591
 
5611
5592
  doOnConnection(nodeClientInstance, clientSocket);
5612
5593
 
5613
- // We execute the listeners entry points:
5594
+ // We execute the listeners entry points registration :
5614
5595
  foreach(nodeClientInstance.receptionEntryPoints,(receptionEntryPoint)=>{
5615
5596
  receptionEntryPoint.execute(clientSocket);
5616
5597
  });
5617
5598
 
5599
+
5600
+ ////
5601
+ // TODO : FIXME
5602
+
5603
+
5604
+
5618
5605
  };
5619
5606
 
5620
5607
  if(!WebsocketImplementation.useSocketIOImplementation) nodeClientInstance.clientSocket.addEventListener("open",doAllOnConnection);
@@ -5757,13 +5744,21 @@ WebsocketImplementation={
5757
5744
 
5758
5745
 
5759
5746
  onConnectionToServer:(doOnConnection)=>{
5747
+ const doAllOnConnection=()=>{
5748
+
5749
+ // To avoid triggering this event several times, depending on the implementation :
5750
+ if(browserInstance.hasConnectEventFired) return;
5751
+ browserInstance.hasConnectEventFired=true;
5752
+
5753
+ doOnConnection(browserInstance, clientSocket);
5754
+
5755
+ // DBG
5756
+ clientSocket.clientId=getUUID();
5757
+
5758
+ };
5760
5759
 
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);
5760
+ if(!WebsocketImplementation.useSocketIOImplementation) browserInstance.clientSocket.addEventListener("open",doAllOnConnection);
5761
+ else browserInstance.clientSocket.on("connect",doAllOnConnection);
5767
5762
 
5768
5763
 
5769
5764
  },
@@ -6224,7 +6219,10 @@ class ListManager{
6224
6219
 
6225
6220
  if(!this.isSessionActive()) return false;
6226
6221
  const clientPosition=this.getItemPosition(clientId);
6227
- const result=((clientPosition-1)/*Because client position starts at 1 !*/<=this.maxItemsNumber);
6222
+ //CAUTION : Client position starts at 1 !
6223
+ const clientIndex=(clientPosition-1);
6224
+ const result=(clientIndex<=this.maxItemsNumber && clientIndex<=this.simultaneousItemsNumber);
6225
+
6228
6226
  return result;
6229
6227
  }
6230
6228
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.217",
3
+ "version": "0.0.220",
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)",