aotrautils-srv 0.0.221 → 0.0.224

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 (22/07/2022-00:54:19)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (30/07/2022-00:00:12)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -23,7 +23,6 @@
23
23
 
24
24
 
25
25
  // COMPATIBILITY browser javascript / nodejs environment :
26
-
27
26
  if(typeof(window)==="undefined") window=global;
28
27
 
29
28
 
@@ -4828,7 +4827,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4828
4827
 
4829
4828
 
4830
4829
 
4831
- /*utils SERVER library associated with aotra version : «1.0.0.000 (22/07/2022-00:54:19)»*/
4830
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (30/07/2022-00:00:12)»*/
4832
4831
  /*-----------------------------------------------------------------------------*/
4833
4832
 
4834
4833
 
@@ -4852,7 +4851,6 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4852
4851
 
4853
4852
 
4854
4853
  // COMPATIBILITY browser javascript / nodejs environment :
4855
-
4856
4854
  if(typeof(window)==="undefined") window=global;
4857
4855
 
4858
4856
 
@@ -4888,12 +4886,12 @@ const FILE_ENCODING="utf8";
4888
4886
  if(typeof(fs)==="undefined"){
4889
4887
  // TRACE
4890
4888
  console.log("WARN : Could not find the nodejs dependency «fs», aborting persister setup.");
4891
- window.getPersister=()=>{ return null; };
4889
+ getPersister=()=>{ return null; };
4892
4890
 
4893
4891
  }else{
4894
4892
 
4895
4893
 
4896
- window.getPersister=function(dataDirPath,suffix=""){
4894
+ getPersister=function(dataDirPath,suffix=""){
4897
4895
 
4898
4896
  let self={
4899
4897
 
@@ -5091,16 +5089,15 @@ WebsocketImplementation={
5091
5089
  // https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications
5092
5090
  if(isNodeContext){
5093
5091
  if(typeof(WebSocket)==="undefined"){
5094
- WebSocket=require("ws");
5095
5092
  // TRACE
5096
5093
  console.log("«ws» SERVER library not called yet, calling it now.");
5094
+ WebSocket=require("ws");
5095
+ if(typeof(WebSocket)==="undefined"){
5096
+ // TRACE
5097
+ console.log("ERROR : «ws» CONSOLE/BROWSER CLIENT/SERVER library not found. Cannot launch nodejs server. Aborting.");
5098
+ }
5097
5099
  return WebsocketImplementation;
5098
5100
  }
5099
- if(typeof(WebSocket)==="undefined"){
5100
- // TRACE
5101
- console.log("ERROR : «ws» CONSOLE/BROWSER CLIENT/SERVER library not found. Cannot launch nodejs server. Aborting.");
5102
- return WebsocketImplementation;
5103
- }
5104
5101
  }
5105
5102
 
5106
5103
  }
@@ -5312,6 +5309,10 @@ WebsocketImplementation={
5312
5309
  // nodeServerInstance.clientsSockets.push(clientSocket);
5313
5310
 
5314
5311
 
5312
+ // DBG
5313
+ clientSocket.clientId=getUUID();
5314
+
5315
+
5315
5316
  // DBG
5316
5317
  console.log("nodeServerInstance.receptionEntryPoints.length:",nodeServerInstance.receptionEntryPoints.length);
5317
5318
 
@@ -5442,7 +5443,7 @@ WebsocketImplementation={
5442
5443
  connectToServer:(serverURL, port, isSecure=false, timeout)=>{
5443
5444
 
5444
5445
  // TRACE
5445
- lognow("INFO : Using websocket implementation : "+(WebsocketImplementation.isNodeContext?"node (server-side)":"browser (client-side)"));
5446
+ lognow("INFO : Using socket library flavor : "+(WebsocketImplementation.isNodeContext?"node (client/server-side)":"browser (client-side only)"));
5446
5447
 
5447
5448
  if(WebsocketImplementation.isNodeContext)
5448
5449
  return WebsocketImplementation.connectToServerFromNode(serverURL, port, isSecure, timeout);
@@ -5458,16 +5459,18 @@ WebsocketImplementation={
5458
5459
  /*private*/connectToServerFromNode:(serverURL, port, isSecure, timeout)=>{
5459
5460
 
5460
5461
 
5461
- // NEW : ws :
5462
- if(typeof(WebSocket)==="undefined"){
5463
- // TRACE
5464
- lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
5465
- return null;
5466
- }
5467
-
5468
5462
  // NODE CLIENT MODE ONLY :
5469
5463
  let clientSocket;
5470
5464
  if(!WebsocketImplementation.useSocketIOImplementation){
5465
+
5466
+ // NEW : ws :
5467
+ if(typeof(WebSocket)==="undefined"){
5468
+ // TRACE
5469
+ lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
5470
+ return null;
5471
+ }
5472
+
5473
+
5471
5474
  clientSocket=new WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
5472
5475
  }else{
5473
5476
  // NOW : socket.io :
@@ -5589,9 +5592,6 @@ WebsocketImplementation={
5589
5592
 
5590
5593
  const clientSocket=nodeClientInstance.clientSocket;
5591
5594
 
5592
- // DBG
5593
- clientSocket.clientId=getUUID();
5594
-
5595
5595
  doOnConnection(nodeClientInstance, clientSocket);
5596
5596
 
5597
5597
  // We execute the listeners entry points registration :
@@ -5750,8 +5750,6 @@ WebsocketImplementation={
5750
5750
 
5751
5751
  const clientSocket=browserInstance.clientSocket;
5752
5752
 
5753
- // DBG
5754
- clientSocket.clientId=getUUID();
5755
5753
 
5756
5754
  doOnConnection(browserInstance, clientSocket);
5757
5755
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.221",
3
+ "version": "0.0.224",
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)",
@@ -24,6 +24,7 @@
24
24
  "fs": "^0.0.1-security",
25
25
  "sjcl": "^1.0.8",
26
26
  "socket.io": "^4.5.1",
27
+ "socket.io-client": "^4.5.1",
27
28
  "ws": "^8.1.0"
28
29
  }
29
30
  }