aotrautils 0.0.87 → 0.0.90

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 (13/07/2022-11:29:34)»*/
3
+ /*utils COMMONS library associated with aotra version : «1.0.0.000 (13/07/2022-23:23:59)»*/
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 (13/07/2022-11:29:34)»*/
4831
+ /*utils CLIENT library associated with aotra version : «1.0.0.000 (13/07/2022-23:23:59)»*/
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 (13/07/2022-11:29:34)»*/
11681
+ /*utils GEOMETRY library associated with aotra version : «1.0.0.000 (13/07/2022-23:23:59)»*/
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 (13/07/2022-11:29:34)»*/
12887
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (13/07/2022-23:23:59)»*/
12888
12888
  /*-----------------------------------------------------------------------------*/
12889
12889
 
12890
12890
 
@@ -12920,10 +12920,6 @@ if(typeof(window)==="undefined") window=global;
12920
12920
  // https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener
12921
12921
 
12922
12922
 
12923
- // DBG
12924
- socketIO=require("socket.io");
12925
- WebSocket=require("ws");
12926
-
12927
12923
 
12928
12924
 
12929
12925
  //let socketIO;
@@ -13135,6 +13131,12 @@ if(typeof(fs)==="undefined"){
13135
13131
  // NODE ONLY SERVER / CLIENTS :
13136
13132
  WebsocketImplementation={
13137
13133
 
13134
+ ////
13135
+
13136
+ socketIO:require("socket.io"),
13137
+ WebSocket:require("ws"),
13138
+
13139
+
13138
13140
  isNodeContext:true,
13139
13141
  useSocketIOImplementation:false,
13140
13142
  useFlatStrings:false,
@@ -13170,6 +13172,10 @@ WebsocketImplementation={
13170
13172
 
13171
13173
  // *********************************************************************************
13172
13174
 
13175
+ WebsocketImplementation.socketIO=require("socket.io");
13176
+ WebsocketImplementation.WebSocket=require("ws");
13177
+
13178
+
13173
13179
 
13174
13180
 
13175
13181
  return WebsocketImplementation;
@@ -13183,28 +13189,23 @@ WebsocketImplementation={
13183
13189
  throw new Error("ERROR : SERVER : Server launch is not supported in a non-nodejs context for any implementation.");
13184
13190
  }
13185
13191
 
13186
- // DBG
13187
- socketIO=require("socket.io");
13188
- WebSocket=require("ws");
13189
-
13190
-
13191
13192
 
13192
13193
 
13193
13194
  // TODO : FIXME : Use one single interface !
13194
13195
  // NODE SERVER MODE ONLY :
13195
13196
  let serverSocket;
13196
13197
  if(!WebsocketImplementation.useSocketIOImplementation){
13197
- serverSocket=new WebSocket.Server({ "server":listenableServer });
13198
+ serverSocket=new WebsocketImplementation.WebSocket.Server({ "server":listenableServer });
13198
13199
  }else{
13199
13200
 
13200
13201
 
13201
13202
  // DBG
13202
- console.log(">>>>>>>socketIO:",JSON.stringify(socketIO));
13203
- console.log(">>>>>>>WebSocket:",JSON.stringify(WebSocket));
13203
+ console.log(">>>>>>>WebsocketImplementation.socketIO:",JSON.stringify(WebsocketImplementation.socketIO));
13204
+ console.log(">>>>>>>WebsocketImplementation.WebSocket:",JSON.stringify(WebsocketImplementation.WebSocket));
13204
13205
 
13205
13206
  // NOW : socket.io :
13206
13207
  // Loading socket.io
13207
- serverSocket=socketIO.listen(listenableServer);
13208
+ serverSocket=WebsocketImplementation.socketIO.listen(listenableServer);
13208
13209
 
13209
13210
  // Setting up the disctonnect event :
13210
13211
  serverSocket.on("endConnection",()=>{
@@ -13292,7 +13293,7 @@ WebsocketImplementation={
13292
13293
 
13293
13294
 
13294
13295
  // TODO : FIXME : Use one single interface !
13295
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13296
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13296
13297
  else if(clientSocket.connected) return;
13297
13298
 
13298
13299
 
@@ -13316,7 +13317,7 @@ WebsocketImplementation={
13316
13317
 
13317
13318
  // TODO : FIXME : Use one single interface !
13318
13319
  let clientSocket=clientSocketParam;
13319
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13320
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13320
13321
  else if(clientSocket.connected) return;
13321
13322
 
13322
13323
 
@@ -13493,7 +13494,7 @@ WebsocketImplementation={
13493
13494
 
13494
13495
 
13495
13496
  // NEW : ws :
13496
- if(typeof(WebSocket)==="undefined"){
13497
+ if(typeof(WebsocketImplementation.WebSocket)==="undefined"){
13497
13498
  // TRACE
13498
13499
  lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
13499
13500
  return null;
@@ -13502,18 +13503,18 @@ WebsocketImplementation={
13502
13503
  // NODE CLIENT MODE ONLY :
13503
13504
  let clientSocket;
13504
13505
  if(!WebsocketImplementation.useSocketIOImplementation){
13505
- clientSocket=new WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
13506
+ clientSocket=new WebsocketImplementation.WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
13506
13507
  }else{
13507
13508
  // NOW : socket.io :
13508
13509
  //client on server-side:
13509
13510
 
13510
13511
 
13511
- if(WebsocketImplementation.isNodeContext && typeof(socketIO)!=="undefined"){
13512
+ if(WebsocketImplementation.isNodeContext && typeof(WebsocketImplementation.socketIO)!=="undefined"){
13512
13513
  // // Node client :
13513
13514
  // connectToServer=function (serverURL, port, isSecure, timeout=10000){
13514
- // return socketIO.connect(serverURL + ":" + port,{timeout: timeout});
13515
+ // return WebsocketImplementation.socketIO.connect(serverURL + ":" + port,{timeout: timeout});
13515
13516
  // }
13516
- clientSocket=socketIO.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13517
+ clientSocket=WebsocketImplementation.socketIO.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13517
13518
  }
13518
13519
  }
13519
13520
 
@@ -13573,7 +13574,7 @@ WebsocketImplementation={
13573
13574
  // console.log("(NODE CLIENT) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
13574
13575
 
13575
13576
  // TODO : FIXME : Use one single interface !
13576
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13577
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13577
13578
  else if(clientSocket.connected) return;
13578
13579
 
13579
13580
 
@@ -13650,7 +13651,7 @@ WebsocketImplementation={
13650
13651
  /*private*/connectToServerFromBrowser:(serverURL, port, isSecure, timeout)=>{
13651
13652
 
13652
13653
  // NEW : ws :
13653
- if(typeof(WebSocket)==="undefined"){
13654
+ if(typeof(WebsocketImplementation.WebSocket)==="undefined"){
13654
13655
  // TRACE
13655
13656
  lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
13656
13657
  return null;
@@ -13660,7 +13661,7 @@ WebsocketImplementation={
13660
13661
  // BROWSER CLIENT MODE ONLY :
13661
13662
  let clientSocket;
13662
13663
  if(!WebsocketImplementation.useSocketIOImplementation){
13663
- clientSocket=new WebSocket(serverURL+":"+port,["ws","wss"]);
13664
+ clientSocket=new WebsocketImplementation.WebSocket(serverURL+":"+port,["ws","wss"]);
13664
13665
  }else if(typeof(io)!=="undefined"){
13665
13666
  // NOW : socket.io :
13666
13667
  // // Browser client :
@@ -13726,7 +13727,7 @@ WebsocketImplementation={
13726
13727
  // console.log("(BROWSER) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
13727
13728
 
13728
13729
  // TODO : FIXME : Use one single interface !
13729
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13730
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13730
13731
  else if(clientSocket.connected) return;
13731
13732
 
13732
13733
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.87",
3
+ "version": "0.0.90",
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)",