aotrautils 0.0.87 → 0.0.88

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:19:22)»*/
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:19:22)»*/
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:19:22)»*/
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:19:22)»*/
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,
@@ -13183,28 +13185,23 @@ WebsocketImplementation={
13183
13185
  throw new Error("ERROR : SERVER : Server launch is not supported in a non-nodejs context for any implementation.");
13184
13186
  }
13185
13187
 
13186
- // DBG
13187
- socketIO=require("socket.io");
13188
- WebSocket=require("ws");
13189
-
13190
-
13191
13188
 
13192
13189
 
13193
13190
  // TODO : FIXME : Use one single interface !
13194
13191
  // NODE SERVER MODE ONLY :
13195
13192
  let serverSocket;
13196
13193
  if(!WebsocketImplementation.useSocketIOImplementation){
13197
- serverSocket=new WebSocket.Server({ "server":listenableServer });
13194
+ serverSocket=new WebsocketImplementation.WebSocket.Server({ "server":listenableServer });
13198
13195
  }else{
13199
13196
 
13200
13197
 
13201
13198
  // DBG
13202
- console.log(">>>>>>>socketIO:",JSON.stringify(socketIO));
13203
- console.log(">>>>>>>WebSocket:",JSON.stringify(WebSocket));
13199
+ console.log(">>>>>>>WebsocketImplementation.socketIO:",JSON.stringify(WebsocketImplementation.socketIO));
13200
+ console.log(">>>>>>>WebsocketImplementation.WebSocket:",JSON.stringify(WebsocketImplementation.WebSocket));
13204
13201
 
13205
13202
  // NOW : socket.io :
13206
13203
  // Loading socket.io
13207
- serverSocket=socketIO.listen(listenableServer);
13204
+ serverSocket=WebsocketImplementation.socketIO.listen(listenableServer);
13208
13205
 
13209
13206
  // Setting up the disctonnect event :
13210
13207
  serverSocket.on("endConnection",()=>{
@@ -13292,7 +13289,7 @@ WebsocketImplementation={
13292
13289
 
13293
13290
 
13294
13291
  // TODO : FIXME : Use one single interface !
13295
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13292
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13296
13293
  else if(clientSocket.connected) return;
13297
13294
 
13298
13295
 
@@ -13316,7 +13313,7 @@ WebsocketImplementation={
13316
13313
 
13317
13314
  // TODO : FIXME : Use one single interface !
13318
13315
  let clientSocket=clientSocketParam;
13319
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13316
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13320
13317
  else if(clientSocket.connected) return;
13321
13318
 
13322
13319
 
@@ -13493,7 +13490,7 @@ WebsocketImplementation={
13493
13490
 
13494
13491
 
13495
13492
  // NEW : ws :
13496
- if(typeof(WebSocket)==="undefined"){
13493
+ if(typeof(WebsocketImplementation.WebSocket)==="undefined"){
13497
13494
  // TRACE
13498
13495
  lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
13499
13496
  return null;
@@ -13502,18 +13499,18 @@ WebsocketImplementation={
13502
13499
  // NODE CLIENT MODE ONLY :
13503
13500
  let clientSocket;
13504
13501
  if(!WebsocketImplementation.useSocketIOImplementation){
13505
- clientSocket=new WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
13502
+ clientSocket=new WebsocketImplementation.WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
13506
13503
  }else{
13507
13504
  // NOW : socket.io :
13508
13505
  //client on server-side:
13509
13506
 
13510
13507
 
13511
- if(WebsocketImplementation.isNodeContext && typeof(socketIO)!=="undefined"){
13508
+ if(WebsocketImplementation.isNodeContext && typeof(WebsocketImplementation.socketIO)!=="undefined"){
13512
13509
  // // Node client :
13513
13510
  // connectToServer=function (serverURL, port, isSecure, timeout=10000){
13514
- // return socketIO.connect(serverURL + ":" + port,{timeout: timeout});
13511
+ // return WebsocketImplementation.socketIO.connect(serverURL + ":" + port,{timeout: timeout});
13515
13512
  // }
13516
- clientSocket=socketIO.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13513
+ clientSocket=WebsocketImplementation.socketIO.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13517
13514
  }
13518
13515
  }
13519
13516
 
@@ -13573,7 +13570,7 @@ WebsocketImplementation={
13573
13570
  // console.log("(NODE CLIENT) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
13574
13571
 
13575
13572
  // TODO : FIXME : Use one single interface !
13576
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13573
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13577
13574
  else if(clientSocket.connected) return;
13578
13575
 
13579
13576
 
@@ -13650,7 +13647,7 @@ WebsocketImplementation={
13650
13647
  /*private*/connectToServerFromBrowser:(serverURL, port, isSecure, timeout)=>{
13651
13648
 
13652
13649
  // NEW : ws :
13653
- if(typeof(WebSocket)==="undefined"){
13650
+ if(typeof(WebsocketImplementation.WebSocket)==="undefined"){
13654
13651
  // TRACE
13655
13652
  lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
13656
13653
  return null;
@@ -13660,7 +13657,7 @@ WebsocketImplementation={
13660
13657
  // BROWSER CLIENT MODE ONLY :
13661
13658
  let clientSocket;
13662
13659
  if(!WebsocketImplementation.useSocketIOImplementation){
13663
- clientSocket=new WebSocket(serverURL+":"+port,["ws","wss"]);
13660
+ clientSocket=new WebsocketImplementation.WebSocket(serverURL+":"+port,["ws","wss"]);
13664
13661
  }else if(typeof(io)!=="undefined"){
13665
13662
  // NOW : socket.io :
13666
13663
  // // Browser client :
@@ -13726,7 +13723,7 @@ WebsocketImplementation={
13726
13723
  // console.log("(BROWSER) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
13727
13724
 
13728
13725
  // TODO : FIXME : Use one single interface !
13729
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13726
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13730
13727
  else if(clientSocket.connected) return;
13731
13728
 
13732
13729
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.87",
3
+ "version": "0.0.88",
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)",