aotrautils-srv 0.0.220 → 0.0.223

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:49:55)»*/
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:49:55)»*/
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 :
@@ -5535,7 +5538,7 @@ WebsocketImplementation={
5535
5538
 
5536
5539
  send:(channelName, data, clientsRoomsTag=null)=>{
5537
5540
 
5538
- let clientSocket=nodeClientInstance.clientSocket;
5541
+ const clientSocket=nodeClientInstance.clientSocket;
5539
5542
 
5540
5543
 
5541
5544
  // // DBG
@@ -5587,7 +5590,7 @@ WebsocketImplementation={
5587
5590
  if(nodeClientInstance.hasConnectEventFired) return;
5588
5591
  nodeClientInstance.hasConnectEventFired=true;
5589
5592
 
5590
- let clientSocket=nodeClientInstance.clientSocket;
5593
+ const clientSocket=nodeClientInstance.clientSocket;
5591
5594
 
5592
5595
  doOnConnection(nodeClientInstance, clientSocket);
5593
5596
 
@@ -5597,11 +5600,6 @@ WebsocketImplementation={
5597
5600
  });
5598
5601
 
5599
5602
 
5600
- ////
5601
- // TODO : FIXME
5602
-
5603
-
5604
-
5605
5603
  };
5606
5604
 
5607
5605
  if(!WebsocketImplementation.useSocketIOImplementation) nodeClientInstance.clientSocket.addEventListener("open",doAllOnConnection);
@@ -5701,7 +5699,7 @@ WebsocketImplementation={
5701
5699
 
5702
5700
  send:(channelName, data, clientsRoomsTag=null)=>{
5703
5701
 
5704
- let clientSocket=browserInstance.clientSocket;
5702
+ const clientSocket=browserInstance.clientSocket;
5705
5703
 
5706
5704
 
5707
5705
  // // DBG
@@ -5750,10 +5748,11 @@ WebsocketImplementation={
5750
5748
  if(browserInstance.hasConnectEventFired) return;
5751
5749
  browserInstance.hasConnectEventFired=true;
5752
5750
 
5751
+ const clientSocket=browserInstance.clientSocket;
5752
+
5753
+
5753
5754
  doOnConnection(browserInstance, clientSocket);
5754
5755
 
5755
- // DBG
5756
- clientSocket.clientId=getUUID();
5757
5756
 
5758
5757
  };
5759
5758
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.220",
3
+ "version": "0.0.223",
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)",