aotrautils 0.0.85 → 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:25:30)»*/
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:25:30)»*/
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:25:30)»*/
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:25:30)»*/
12887
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (13/07/2022-23:19:22)»*/
12888
12888
  /*-----------------------------------------------------------------------------*/
12889
12889
 
12890
12890
 
@@ -12919,8 +12919,8 @@ if(typeof(window)==="undefined") window=global;
12919
12919
  // https://stackoverflow.com/questions/6599470/node-js-socket-io-with-ssl
12920
12920
  // https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener
12921
12921
 
12922
- const socketIO=require("socket.io");;
12923
- const WebSocket=require("ws");;
12922
+
12923
+
12924
12924
 
12925
12925
  //let socketIO;
12926
12926
  //let WebSocket;
@@ -13131,6 +13131,12 @@ if(typeof(fs)==="undefined"){
13131
13131
  // NODE ONLY SERVER / CLIENTS :
13132
13132
  WebsocketImplementation={
13133
13133
 
13134
+ ////
13135
+
13136
+ socketIO:require("socket.io"),
13137
+ WebSocket:require("ws"),
13138
+
13139
+
13134
13140
  isNodeContext:true,
13135
13141
  useSocketIOImplementation:false,
13136
13142
  useFlatStrings:false,
@@ -13179,21 +13185,23 @@ WebsocketImplementation={
13179
13185
  throw new Error("ERROR : SERVER : Server launch is not supported in a non-nodejs context for any implementation.");
13180
13186
  }
13181
13187
 
13188
+
13189
+
13182
13190
  // TODO : FIXME : Use one single interface !
13183
13191
  // NODE SERVER MODE ONLY :
13184
13192
  let serverSocket;
13185
13193
  if(!WebsocketImplementation.useSocketIOImplementation){
13186
- serverSocket=new WebSocket.Server({ "server":listenableServer });
13194
+ serverSocket=new WebsocketImplementation.WebSocket.Server({ "server":listenableServer });
13187
13195
  }else{
13188
13196
 
13189
13197
 
13190
13198
  // DBG
13191
- console.log(">>>>>>>socketIO:",JSON.stringify(socketIO));
13192
- console.log(">>>>>>>WebSocket:",JSON.stringify(WebSocket));
13199
+ console.log(">>>>>>>WebsocketImplementation.socketIO:",JSON.stringify(WebsocketImplementation.socketIO));
13200
+ console.log(">>>>>>>WebsocketImplementation.WebSocket:",JSON.stringify(WebsocketImplementation.WebSocket));
13193
13201
 
13194
13202
  // NOW : socket.io :
13195
13203
  // Loading socket.io
13196
- serverSocket=socketIO.listen(listenableServer);
13204
+ serverSocket=WebsocketImplementation.socketIO.listen(listenableServer);
13197
13205
 
13198
13206
  // Setting up the disctonnect event :
13199
13207
  serverSocket.on("endConnection",()=>{
@@ -13281,7 +13289,7 @@ WebsocketImplementation={
13281
13289
 
13282
13290
 
13283
13291
  // TODO : FIXME : Use one single interface !
13284
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13292
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13285
13293
  else if(clientSocket.connected) return;
13286
13294
 
13287
13295
 
@@ -13305,7 +13313,7 @@ WebsocketImplementation={
13305
13313
 
13306
13314
  // TODO : FIXME : Use one single interface !
13307
13315
  let clientSocket=clientSocketParam;
13308
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13316
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13309
13317
  else if(clientSocket.connected) return;
13310
13318
 
13311
13319
 
@@ -13482,7 +13490,7 @@ WebsocketImplementation={
13482
13490
 
13483
13491
 
13484
13492
  // NEW : ws :
13485
- if(typeof(WebSocket)==="undefined"){
13493
+ if(typeof(WebsocketImplementation.WebSocket)==="undefined"){
13486
13494
  // TRACE
13487
13495
  lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
13488
13496
  return null;
@@ -13491,18 +13499,18 @@ WebsocketImplementation={
13491
13499
  // NODE CLIENT MODE ONLY :
13492
13500
  let clientSocket;
13493
13501
  if(!WebsocketImplementation.useSocketIOImplementation){
13494
- clientSocket=new WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
13502
+ clientSocket=new WebsocketImplementation.WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
13495
13503
  }else{
13496
13504
  // NOW : socket.io :
13497
13505
  //client on server-side:
13498
13506
 
13499
13507
 
13500
- if(WebsocketImplementation.isNodeContext && typeof(socketIO)!=="undefined"){
13508
+ if(WebsocketImplementation.isNodeContext && typeof(WebsocketImplementation.socketIO)!=="undefined"){
13501
13509
  // // Node client :
13502
13510
  // connectToServer=function (serverURL, port, isSecure, timeout=10000){
13503
- // return socketIO.connect(serverURL + ":" + port,{timeout: timeout});
13511
+ // return WebsocketImplementation.socketIO.connect(serverURL + ":" + port,{timeout: timeout});
13504
13512
  // }
13505
- clientSocket=socketIO.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13513
+ clientSocket=WebsocketImplementation.socketIO.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13506
13514
  }
13507
13515
  }
13508
13516
 
@@ -13562,7 +13570,7 @@ WebsocketImplementation={
13562
13570
  // console.log("(NODE CLIENT) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
13563
13571
 
13564
13572
  // TODO : FIXME : Use one single interface !
13565
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13573
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13566
13574
  else if(clientSocket.connected) return;
13567
13575
 
13568
13576
 
@@ -13639,7 +13647,7 @@ WebsocketImplementation={
13639
13647
  /*private*/connectToServerFromBrowser:(serverURL, port, isSecure, timeout)=>{
13640
13648
 
13641
13649
  // NEW : ws :
13642
- if(typeof(WebSocket)==="undefined"){
13650
+ if(typeof(WebsocketImplementation.WebSocket)==="undefined"){
13643
13651
  // TRACE
13644
13652
  lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
13645
13653
  return null;
@@ -13649,7 +13657,7 @@ WebsocketImplementation={
13649
13657
  // BROWSER CLIENT MODE ONLY :
13650
13658
  let clientSocket;
13651
13659
  if(!WebsocketImplementation.useSocketIOImplementation){
13652
- clientSocket=new WebSocket(serverURL+":"+port,["ws","wss"]);
13660
+ clientSocket=new WebsocketImplementation.WebSocket(serverURL+":"+port,["ws","wss"]);
13653
13661
  }else if(typeof(io)!=="undefined"){
13654
13662
  // NOW : socket.io :
13655
13663
  // // Browser client :
@@ -13715,7 +13723,7 @@ WebsocketImplementation={
13715
13723
  // console.log("(BROWSER) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
13716
13724
 
13717
13725
  // TODO : FIXME : Use one single interface !
13718
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13726
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13719
13727
  else if(clientSocket.connected) return;
13720
13728
 
13721
13729
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.85",
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)",