aotrautils 0.0.204 → 0.0.207
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.
- aotrautils/aotrautils.build.js +49 -31
- aotrautils/package.json +1 -1
aotrautils/aotrautils.build.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
/*utils COMMONS library associated with aotra version : «1.0.0.000 (19/07/2022-03:
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1.0.0.000 (19/07/2022-03:36:03)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -4828,7 +4828,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
4828
4828
|
|
|
4829
4829
|
|
|
4830
4830
|
|
|
4831
|
-
/*utils CLIENT library associated with aotra version : «1.0.0.000 (19/07/2022-03:
|
|
4831
|
+
/*utils CLIENT library associated with aotra version : «1.0.0.000 (19/07/2022-03:36:03)»*/
|
|
4832
4832
|
/*-----------------------------------------------------------------------------*/
|
|
4833
4833
|
/* ## Utility global methods in a browser (htmljs) client environment.
|
|
4834
4834
|
*
|
|
@@ -11678,7 +11678,7 @@ createFusrodaClient=function(doOnClientReady, doOnDataReception, urlParam=null,
|
|
|
11678
11678
|
|
|
11679
11679
|
|
|
11680
11680
|
|
|
11681
|
-
/*utils GEOMETRY library associated with aotra version : «1.0.0.000 (19/07/2022-03:
|
|
11681
|
+
/*utils GEOMETRY library associated with aotra version : «1.0.0.000 (19/07/2022-03:36:03)»*/
|
|
11682
11682
|
/*-----------------------------------------------------------------------------*/
|
|
11683
11683
|
|
|
11684
11684
|
|
|
@@ -12884,7 +12884,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
|
|
|
12884
12884
|
// MUST REMAIN AT THE END OF THIS LIBRARY FILE !
|
|
12885
12885
|
|
|
12886
12886
|
AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
|
|
12887
|
-
/*utils SERVER library associated with aotra version : «1.0.0.000 (19/07/2022-03:
|
|
12887
|
+
/*utils SERVER library associated with aotra version : «1.0.0.000 (19/07/2022-03:36:03)»*/
|
|
12888
12888
|
/*-----------------------------------------------------------------------------*/
|
|
12889
12889
|
|
|
12890
12890
|
|
|
@@ -13387,12 +13387,16 @@ WebsocketImplementation={
|
|
|
13387
13387
|
doOnConnection(nodeServerInstance, clientSocket);
|
|
13388
13388
|
|
|
13389
13389
|
|
|
13390
|
+
// DBG
|
|
13391
|
+
lognow("DEBUG : Starting ping-pong with client : clientSocket.id:",clientSocket.id);
|
|
13392
|
+
|
|
13393
|
+
|
|
13390
13394
|
// To make the server aware of the clients connections states :
|
|
13395
|
+
clientSocket.isConnectionAlive=true;
|
|
13391
13396
|
clientSocket.stateCheckInterval=setInterval(()=>{
|
|
13392
13397
|
|
|
13393
13398
|
|
|
13394
|
-
if (clientSocket.
|
|
13395
|
-
clearInterval(clientSocket.stateCheckInterval);
|
|
13399
|
+
if (clientSocket.isConnectionAlive===false){
|
|
13396
13400
|
|
|
13397
13401
|
// TODO : FIXME : DUPLICATED CODE :
|
|
13398
13402
|
// TODO : FIXME : Use one single interface !
|
|
@@ -13402,35 +13406,37 @@ WebsocketImplementation={
|
|
|
13402
13406
|
// TODO : FIXME : DUPLICATED CODE :
|
|
13403
13407
|
if(!empty(nodeServerInstance.onClientLostListeners))
|
|
13404
13408
|
foreach(nodeServerInstance.onClientLostListeners,l=>{l.execute(clientSocket);});
|
|
13409
|
+
|
|
13405
13410
|
|
|
13411
|
+
clearInterval(clientSocket.stateCheckInterval);
|
|
13406
13412
|
return;
|
|
13407
13413
|
}
|
|
13408
13414
|
|
|
13409
|
-
clientSocket.
|
|
13410
|
-
try{
|
|
13415
|
+
clientSocket.isConnectionAlive=false;
|
|
13416
|
+
// try{
|
|
13411
13417
|
|
|
13412
13418
|
// OLD :
|
|
13413
13419
|
// if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.ping();
|
|
13414
13420
|
// else clientSocket.emit("ping");
|
|
13415
|
-
|
|
13421
|
+
|
|
13422
|
+
nodeServerInstance.send("protocol",{type:"ping"});
|
|
13416
13423
|
|
|
13417
|
-
|
|
13418
13424
|
|
|
13419
|
-
}catch(error){
|
|
13420
|
-
lognow("ERROR : A problem occurred when tried to ping client socket : ",error);
|
|
13421
|
-
// We effectively end the client connection to this server :
|
|
13422
|
-
|
|
13423
|
-
// TODO : FIXME : DUPLICATED CODE :
|
|
13424
|
-
// TODO : FIXME : Use one single interface !
|
|
13425
|
-
if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.terminate();
|
|
13426
|
-
else clientSocket.emit("endConnection");
|
|
13427
|
-
|
|
13428
|
-
// TODO : FIXME : DUPLICATED CODE :
|
|
13429
|
-
if(!empty(nodeServerInstance.onClientLostListeners))
|
|
13430
|
-
foreach(nodeServerInstance.onClientLostListeners,l=>{l.execute(clientSocket);});
|
|
13431
|
-
|
|
13432
|
-
return;
|
|
13433
|
-
}
|
|
13425
|
+
// }catch(error){
|
|
13426
|
+
// lognow("ERROR : A problem occurred when tried to ping client socket : ",error);
|
|
13427
|
+
// // We effectively end the client connection to this server :
|
|
13428
|
+
//
|
|
13429
|
+
// // TODO : FIXME : DUPLICATED CODE :
|
|
13430
|
+
// // TODO : FIXME : Use one single interface !
|
|
13431
|
+
// if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.terminate();
|
|
13432
|
+
// else clientSocket.emit("endConnection");
|
|
13433
|
+
//
|
|
13434
|
+
// // TODO : FIXME : DUPLICATED CODE :
|
|
13435
|
+
// if(!empty(nodeServerInstance.onClientLostListeners))
|
|
13436
|
+
// foreach(nodeServerInstance.onClientLostListeners,l=>{l.execute(clientSocket);});
|
|
13437
|
+
//
|
|
13438
|
+
// return;
|
|
13439
|
+
// }
|
|
13434
13440
|
|
|
13435
13441
|
|
|
13436
13442
|
}, nodeServerInstance.clientTimeoutMillis);
|
|
@@ -13439,17 +13445,17 @@ WebsocketImplementation={
|
|
|
13439
13445
|
// // OLD :
|
|
13440
13446
|
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
13441
13447
|
// clientSocket.on("pong",()=>{
|
|
13442
|
-
// clientSocket.
|
|
13448
|
+
// clientSocket.isConnectionAlive=true;
|
|
13443
13449
|
// });
|
|
13444
13450
|
// }else{
|
|
13445
13451
|
// clientSocket.on("ping",()=>{
|
|
13446
|
-
// clientSocket.
|
|
13452
|
+
// clientSocket.isConnectionAlive=true;
|
|
13447
13453
|
// });
|
|
13448
13454
|
// }
|
|
13449
13455
|
|
|
13450
13456
|
nodeServerInstance.receive("protocol",(message)=>{
|
|
13451
13457
|
if(message.type!=="pong") return;
|
|
13452
|
-
clientSocket.
|
|
13458
|
+
clientSocket.isConnectionAlive=true;
|
|
13453
13459
|
});
|
|
13454
13460
|
|
|
13455
13461
|
|
|
@@ -14213,12 +14219,16 @@ class ListManager{
|
|
|
14213
14219
|
lognow("ERROR : Cannot add null item.");
|
|
14214
14220
|
return;
|
|
14215
14221
|
}
|
|
14216
|
-
const numberOfItemsCurrently=
|
|
14222
|
+
const numberOfItemsCurrently=getArraySize(this.itemsInfos);
|
|
14217
14223
|
if(this.maxItemsNumber<=numberOfItemsCurrently){
|
|
14218
14224
|
// TRACE
|
|
14219
14225
|
lognow("ERROR : Cannot add item with id «"+id+"», list already full.");
|
|
14220
14226
|
return;
|
|
14221
14227
|
}
|
|
14228
|
+
|
|
14229
|
+
// DBG
|
|
14230
|
+
lognow(">>>>>>>>>numberOfItemsCurrently:",numberOfItemsCurrently);
|
|
14231
|
+
|
|
14222
14232
|
if(numberOfItemsCurrently==0 && this.mode==="startAtConnexion"){
|
|
14223
14233
|
this.startSession();
|
|
14224
14234
|
}
|
|
@@ -14244,9 +14254,13 @@ class ListManager{
|
|
|
14244
14254
|
}
|
|
14245
14255
|
|
|
14246
14256
|
isClientActive(clientId){
|
|
14257
|
+
|
|
14258
|
+
// DBG
|
|
14259
|
+
lognow(" this.isSessionActive()",this.isSessionActive());
|
|
14260
|
+
|
|
14247
14261
|
if(!this.isSessionActive()) return false;
|
|
14248
14262
|
const clientPosition=this.getItemPosition(clientId);
|
|
14249
|
-
const result=(clientPosition
|
|
14263
|
+
const result=((clientPosition-1)/*Because client position starts at 1 !*/<=this.maxItemsNumber);
|
|
14250
14264
|
return result;
|
|
14251
14265
|
}
|
|
14252
14266
|
|
|
@@ -14273,10 +14287,14 @@ class ListManager{
|
|
|
14273
14287
|
|
|
14274
14288
|
let id=null;
|
|
14275
14289
|
foreach(this.itemsInfos,(itemInfos,key)=>{
|
|
14276
|
-
if(itemInfos.item===item
|
|
14290
|
+
if(itemInfos.item===item
|
|
14291
|
+
// DEBUG ONLY :
|
|
14292
|
+
|| (itemInfos.item.id && item.id && itemInfos.item.id===item.id)
|
|
14293
|
+
){
|
|
14277
14294
|
id=key;
|
|
14278
14295
|
return "break";
|
|
14279
14296
|
}
|
|
14297
|
+
|
|
14280
14298
|
});
|
|
14281
14299
|
|
|
14282
14300
|
if(!id){
|
aotrautils/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.207",
|
|
4
4
|
"main": "aotrautils.build.js",
|
|
5
5
|
"description": "A library for vanilla javascript utils (client-side) used in aotra javascript CMS",
|
|
6
6
|
"author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",
|