aotrautils 0.0.124 → 0.0.127
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 +53 -18
- 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 (16/07/2022-16:
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1.0.0.000 (16/07/2022-16:48:44)»*/
|
|
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 (16/07/2022-16:
|
|
4831
|
+
/*utils CLIENT library associated with aotra version : «1.0.0.000 (16/07/2022-16:48:44)»*/
|
|
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 (16/07/2022-16:
|
|
11681
|
+
/*utils GEOMETRY library associated with aotra version : «1.0.0.000 (16/07/2022-16:48:44)»*/
|
|
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 (16/07/2022-16:
|
|
12887
|
+
/*utils SERVER library associated with aotra version : «1.0.0.000 (16/07/2022-16:48:44)»*/
|
|
12888
12888
|
/*-----------------------------------------------------------------------------*/
|
|
12889
12889
|
|
|
12890
12890
|
|
|
@@ -12928,10 +12928,8 @@ if(typeof(window)==="undefined") window=global;
|
|
|
12928
12928
|
// https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications
|
|
12929
12929
|
|
|
12930
12930
|
// We have to import both implementations, regardless of which one is chosen :
|
|
12931
|
-
//
|
|
12932
|
-
//
|
|
12933
|
-
Socket=require("socket.io");
|
|
12934
|
-
WebSocket=require("ws");
|
|
12931
|
+
//Socket=require("socket.io");
|
|
12932
|
+
//WebSocket=require("ws");
|
|
12935
12933
|
|
|
12936
12934
|
|
|
12937
12935
|
|
|
@@ -13122,21 +13120,46 @@ WebsocketImplementation={
|
|
|
13122
13120
|
getStatic:(isNodeContext=true, useSocketIOImplementation=false)=>{
|
|
13123
13121
|
|
|
13124
13122
|
WebsocketImplementation.isNodeContext=isNodeContext;
|
|
13125
|
-
|
|
13126
13123
|
WebsocketImplementation.useSocketIOImplementation=useSocketIOImplementation;
|
|
13127
13124
|
|
|
13128
13125
|
if(WebsocketImplementation.useSocketIOImplementation){
|
|
13129
13126
|
// TRACE
|
|
13130
13127
|
lognow("INFO : (SERVER/CLIENT) Using socket.io websocket implementation.");
|
|
13128
|
+
|
|
13129
|
+
if(isNodeContext && typeof(Socket)==="undefined"){
|
|
13130
|
+
// TRACE
|
|
13131
|
+
console.log("«socket.io» SERVER library not called yet, calling it now.");
|
|
13132
|
+
Socket=require("socket.io");
|
|
13133
|
+
return WebsocketImplementation;
|
|
13134
|
+
}
|
|
13135
|
+
if(typeof(Socket)==="undefined"){
|
|
13136
|
+
// TRACE
|
|
13137
|
+
console.log("ERROR : «socket.io» CONSOLE/BROWSER CLIENT/SERVER library not found. Cannot launch nodejs server. Aborting.");
|
|
13138
|
+
return WebsocketImplementation;
|
|
13139
|
+
}
|
|
13131
13140
|
|
|
13132
13141
|
}else{
|
|
13133
13142
|
// TRACE
|
|
13134
|
-
lognow("INFO : (SERVER/CLIENT) Using native
|
|
13143
|
+
lognow("INFO : (SERVER/CLIENT) Using native WebSocket implementation.");
|
|
13144
|
+
|
|
13145
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications
|
|
13146
|
+
if(isNodeContext && typeof(WebSocket)==="undefined"){
|
|
13147
|
+
WebSocket=require("ws");
|
|
13148
|
+
// TRACE
|
|
13149
|
+
console.log("«ws» SERVER library not called yet, calling it now.");
|
|
13150
|
+
return WebsocketImplementation;
|
|
13151
|
+
}
|
|
13152
|
+
if(typeof(WebSocket)==="undefined"){
|
|
13153
|
+
// TRACE
|
|
13154
|
+
console.log("ERROR : «ws» CONSOLE/BROWSER CLIENT/SERVER library not found. Cannot launch nodejs server. Aborting.");
|
|
13155
|
+
return WebsocketImplementation;
|
|
13156
|
+
}
|
|
13135
13157
|
|
|
13136
13158
|
}
|
|
13159
|
+
|
|
13137
13160
|
|
|
13138
13161
|
// *********************************************************************************
|
|
13139
|
-
|
|
13162
|
+
|
|
13140
13163
|
|
|
13141
13164
|
return WebsocketImplementation;
|
|
13142
13165
|
},
|
|
@@ -13352,7 +13375,10 @@ WebsocketImplementation={
|
|
|
13352
13375
|
|
|
13353
13376
|
clientSocket.isAlive=false;
|
|
13354
13377
|
try{
|
|
13355
|
-
|
|
13378
|
+
|
|
13379
|
+
if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.ping();
|
|
13380
|
+
else clientSocket.emit("ping");
|
|
13381
|
+
|
|
13356
13382
|
}catch(error){
|
|
13357
13383
|
lognow("ERROR : A problem occurred when tried to ping client socket : ",error);
|
|
13358
13384
|
// We effectively end the client connection to this server :
|
|
@@ -13371,9 +13397,16 @@ WebsocketImplementation={
|
|
|
13371
13397
|
|
|
13372
13398
|
|
|
13373
13399
|
}, nodeServerInstance.clientTimeoutMillis);
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13400
|
+
|
|
13401
|
+
if(!WebsocketImplementation.useSocketIOImplementation){
|
|
13402
|
+
clientSocket.on("pong",()=>{
|
|
13403
|
+
clientSocket.isAlive=true;
|
|
13404
|
+
});
|
|
13405
|
+
}else{
|
|
13406
|
+
clientSocket.on("ping",()=>{
|
|
13407
|
+
clientSocket.isAlive=true;
|
|
13408
|
+
});
|
|
13409
|
+
}
|
|
13377
13410
|
|
|
13378
13411
|
|
|
13379
13412
|
|
|
@@ -13450,7 +13483,6 @@ WebsocketImplementation={
|
|
|
13450
13483
|
/*private*/connectToServerFromNode:(serverURL, port, isSecure, timeout)=>{
|
|
13451
13484
|
|
|
13452
13485
|
|
|
13453
|
-
|
|
13454
13486
|
// NEW : ws :
|
|
13455
13487
|
if(typeof(WebSocket)==="undefined"){
|
|
13456
13488
|
// TRACE
|
|
@@ -13473,7 +13505,8 @@ WebsocketImplementation={
|
|
|
13473
13505
|
// }
|
|
13474
13506
|
|
|
13475
13507
|
// OLD SYNTAX: clientSocket=Socket.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
13476
|
-
|
|
13508
|
+
// clientSocket=new Socket.Client???(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
13509
|
+
clientSocket=io(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
13477
13510
|
|
|
13478
13511
|
}
|
|
13479
13512
|
}
|
|
@@ -13632,7 +13665,9 @@ WebsocketImplementation={
|
|
|
13632
13665
|
// }else{
|
|
13633
13666
|
// // TRACE
|
|
13634
13667
|
// console.log("ERROR : Could not initialize socket !");
|
|
13635
|
-
clientSocket=io.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
13668
|
+
// OLD SYNTAX :clientSocket=io.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
13669
|
+
clientSocket=io(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
13670
|
+
|
|
13636
13671
|
}
|
|
13637
13672
|
|
|
13638
13673
|
|
aotrautils/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.127",
|
|
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)",
|