aotrautils 0.0.125 → 0.0.128

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 (16/07/2022-16:26:34)»*/
3
+ /*utils COMMONS library associated with aotra version : «1.0.0.000 (16/07/2022-16:58:53)»*/
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:26:34)»*/
4831
+ /*utils CLIENT library associated with aotra version : «1.0.0.000 (16/07/2022-16:58:53)»*/
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:26:34)»*/
11681
+ /*utils GEOMETRY library associated with aotra version : «1.0.0.000 (16/07/2022-16:58:53)»*/
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:26:34)»*/
12887
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (16/07/2022-16:58:53)»*/
12888
12888
  /*-----------------------------------------------------------------------------*/
12889
12889
 
12890
12890
 
@@ -13126,16 +13126,18 @@ WebsocketImplementation={
13126
13126
  // TRACE
13127
13127
  lognow("INFO : (SERVER/CLIENT) Using socket.io websocket implementation.");
13128
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;
13129
+ if(isNodeContext){
13130
+ if(typeof(Socket)==="undefined"){
13131
+ // TRACE
13132
+ console.log("«socket.io» SERVER library not called yet, calling it now.");
13133
+ Socket=require("socket.io");
13134
+ return WebsocketImplementation;
13135
+ }
13136
+ if(typeof(Socket)==="undefined"){
13137
+ // TRACE
13138
+ console.log("ERROR : «socket.io» CONSOLE/BROWSER CLIENT/SERVER library not found. Cannot launch nodejs server. Aborting.");
13139
+ return WebsocketImplementation;
13140
+ }
13139
13141
  }
13140
13142
 
13141
13143
  }else{
@@ -13143,17 +13145,19 @@ WebsocketImplementation={
13143
13145
  lognow("INFO : (SERVER/CLIENT) Using native WebSocket implementation.");
13144
13146
 
13145
13147
  // 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;
13148
+ if(isNodeContext){
13149
+ if(typeof(WebSocket)==="undefined"){
13150
+ WebSocket=require("ws");
13151
+ // TRACE
13152
+ console.log("«ws» SERVER library not called yet, calling it now.");
13153
+ return WebsocketImplementation;
13154
+ }
13155
+ if(typeof(WebSocket)==="undefined"){
13156
+ // TRACE
13157
+ console.log("ERROR : «ws» CONSOLE/BROWSER CLIENT/SERVER library not found. Cannot launch nodejs server. Aborting.");
13158
+ return WebsocketImplementation;
13159
+ }
13151
13160
  }
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
- }
13157
13161
 
13158
13162
  }
13159
13163
 
@@ -13375,7 +13379,10 @@ WebsocketImplementation={
13375
13379
 
13376
13380
  clientSocket.isAlive=false;
13377
13381
  try{
13378
- clientSocket.ping();
13382
+
13383
+ if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.ping();
13384
+ else clientSocket.emit("ping");
13385
+
13379
13386
  }catch(error){
13380
13387
  lognow("ERROR : A problem occurred when tried to ping client socket : ",error);
13381
13388
  // We effectively end the client connection to this server :
@@ -13394,9 +13401,16 @@ WebsocketImplementation={
13394
13401
 
13395
13402
 
13396
13403
  }, nodeServerInstance.clientTimeoutMillis);
13397
- clientSocket.on("pong",()=>{
13398
- clientSocket.isAlive=true;
13399
- });
13404
+
13405
+ if(!WebsocketImplementation.useSocketIOImplementation){
13406
+ clientSocket.on("pong",()=>{
13407
+ clientSocket.isAlive=true;
13408
+ });
13409
+ }else{
13410
+ clientSocket.on("ping",()=>{
13411
+ clientSocket.isAlive=true;
13412
+ });
13413
+ }
13400
13414
 
13401
13415
 
13402
13416
 
@@ -13473,7 +13487,6 @@ WebsocketImplementation={
13473
13487
  /*private*/connectToServerFromNode:(serverURL, port, isSecure, timeout)=>{
13474
13488
 
13475
13489
 
13476
-
13477
13490
  // NEW : ws :
13478
13491
  if(typeof(WebSocket)==="undefined"){
13479
13492
  // TRACE
@@ -13496,7 +13509,8 @@ WebsocketImplementation={
13496
13509
  // }
13497
13510
 
13498
13511
  // OLD SYNTAX: clientSocket=Socket.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13499
- clientSocket=Socket(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13512
+ // clientSocket=new Socket.Client???(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13513
+ clientSocket=io(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13500
13514
 
13501
13515
  }
13502
13516
  }
@@ -13656,7 +13670,7 @@ WebsocketImplementation={
13656
13670
  // // TRACE
13657
13671
  // console.log("ERROR : Could not initialize socket !");
13658
13672
  // OLD SYNTAX :clientSocket=io.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13659
- clientSocket=Socket(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13673
+ clientSocket=io(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13660
13674
 
13661
13675
  }
13662
13676
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.125",
3
+ "version": "0.0.128",
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)",