aotrautils 0.0.86 → 0.0.89

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:27:48)»*/
3
+ /*utils COMMONS library associated with aotra version : «1.0.0.000 (13/07/2022-23:23:15)»*/
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:27:48)»*/
4831
+ /*utils CLIENT library associated with aotra version : «1.0.0.000 (13/07/2022-23:23:15)»*/
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:27:48)»*/
11681
+ /*utils GEOMETRY library associated with aotra version : «1.0.0.000 (13/07/2022-23:23:15)»*/
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:27:48)»*/
12887
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (13/07/2022-23:23:15)»*/
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,21 +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
 
13192
+
13193
+
13186
13194
  // TODO : FIXME : Use one single interface !
13187
13195
  // NODE SERVER MODE ONLY :
13188
13196
  let serverSocket;
13189
13197
  if(!WebsocketImplementation.useSocketIOImplementation){
13190
- serverSocket=new WebSocket.Server({ "server":listenableServer });
13198
+ serverSocket=new WebsocketImplementation.WebSocket.Server({ "server":listenableServer });
13191
13199
  }else{
13192
13200
 
13193
13201
 
13194
13202
  // DBG
13195
- console.log(">>>>>>>socketIO:",JSON.stringify(socketIO));
13196
- console.log(">>>>>>>WebSocket:",JSON.stringify(WebSocket));
13203
+ console.log(">>>>>>>WebsocketImplementation.socketIO:",JSON.stringify(WebsocketImplementation.socketIO));
13204
+ console.log(">>>>>>>WebsocketImplementation.WebSocket:",JSON.stringify(WebsocketImplementation.WebSocket));
13197
13205
 
13198
13206
  // NOW : socket.io :
13199
13207
  // Loading socket.io
13200
- serverSocket=socketIO.listen(listenableServer);
13208
+ serverSocket=WebsocketImplementation.socketIO.listen(listenableServer);
13201
13209
 
13202
13210
  // Setting up the disctonnect event :
13203
13211
  serverSocket.on("endConnection",()=>{
@@ -13285,7 +13293,7 @@ WebsocketImplementation={
13285
13293
 
13286
13294
 
13287
13295
  // TODO : FIXME : Use one single interface !
13288
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13296
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13289
13297
  else if(clientSocket.connected) return;
13290
13298
 
13291
13299
 
@@ -13309,7 +13317,7 @@ WebsocketImplementation={
13309
13317
 
13310
13318
  // TODO : FIXME : Use one single interface !
13311
13319
  let clientSocket=clientSocketParam;
13312
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13320
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13313
13321
  else if(clientSocket.connected) return;
13314
13322
 
13315
13323
 
@@ -13486,7 +13494,7 @@ WebsocketImplementation={
13486
13494
 
13487
13495
 
13488
13496
  // NEW : ws :
13489
- if(typeof(WebSocket)==="undefined"){
13497
+ if(typeof(WebsocketImplementation.WebSocket)==="undefined"){
13490
13498
  // TRACE
13491
13499
  lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
13492
13500
  return null;
@@ -13495,18 +13503,18 @@ WebsocketImplementation={
13495
13503
  // NODE CLIENT MODE ONLY :
13496
13504
  let clientSocket;
13497
13505
  if(!WebsocketImplementation.useSocketIOImplementation){
13498
- clientSocket=new WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
13506
+ clientSocket=new WebsocketImplementation.WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
13499
13507
  }else{
13500
13508
  // NOW : socket.io :
13501
13509
  //client on server-side:
13502
13510
 
13503
13511
 
13504
- if(WebsocketImplementation.isNodeContext && typeof(socketIO)!=="undefined"){
13512
+ if(WebsocketImplementation.isNodeContext && typeof(WebsocketImplementation.socketIO)!=="undefined"){
13505
13513
  // // Node client :
13506
13514
  // connectToServer=function (serverURL, port, isSecure, timeout=10000){
13507
- // return socketIO.connect(serverURL + ":" + port,{timeout: timeout});
13515
+ // return WebsocketImplementation.socketIO.connect(serverURL + ":" + port,{timeout: timeout});
13508
13516
  // }
13509
- clientSocket=socketIO.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13517
+ clientSocket=WebsocketImplementation.socketIO.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13510
13518
  }
13511
13519
  }
13512
13520
 
@@ -13566,7 +13574,7 @@ WebsocketImplementation={
13566
13574
  // console.log("(NODE CLIENT) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
13567
13575
 
13568
13576
  // TODO : FIXME : Use one single interface !
13569
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13577
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13570
13578
  else if(clientSocket.connected) return;
13571
13579
 
13572
13580
 
@@ -13643,7 +13651,7 @@ WebsocketImplementation={
13643
13651
  /*private*/connectToServerFromBrowser:(serverURL, port, isSecure, timeout)=>{
13644
13652
 
13645
13653
  // NEW : ws :
13646
- if(typeof(WebSocket)==="undefined"){
13654
+ if(typeof(WebsocketImplementation.WebSocket)==="undefined"){
13647
13655
  // TRACE
13648
13656
  lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
13649
13657
  return null;
@@ -13653,7 +13661,7 @@ WebsocketImplementation={
13653
13661
  // BROWSER CLIENT MODE ONLY :
13654
13662
  let clientSocket;
13655
13663
  if(!WebsocketImplementation.useSocketIOImplementation){
13656
- clientSocket=new WebSocket(serverURL+":"+port,["ws","wss"]);
13664
+ clientSocket=new WebsocketImplementation.WebSocket(serverURL+":"+port,["ws","wss"]);
13657
13665
  }else if(typeof(io)!=="undefined"){
13658
13666
  // NOW : socket.io :
13659
13667
  // // Browser client :
@@ -13719,7 +13727,7 @@ WebsocketImplementation={
13719
13727
  // console.log("(BROWSER) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
13720
13728
 
13721
13729
  // TODO : FIXME : Use one single interface !
13722
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13730
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13723
13731
  else if(clientSocket.connected) return;
13724
13732
 
13725
13733
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.86",
3
+ "version": "0.0.89",
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)",