aotrautils 0.0.110 → 0.0.113

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 (16/07/2022-14:36:04)»*/
3
+ /*utils COMMONS library associated with aotra version : «1.0.0.000 (16/07/2022-14:54:41)»*/
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 (16/07/2022-14:36:04)»*/
4831
+ /*utils CLIENT library associated with aotra version : «1.0.0.000 (16/07/2022-14:54:41)»*/
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 (16/07/2022-14:36:04)»*/
11681
+ /*utils GEOMETRY library associated with aotra version : «1.0.0.000 (16/07/2022-14:54:41)»*/
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 (16/07/2022-14:36:04)»*/
12887
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (16/07/2022-14:54:41)»*/
12888
12888
  /*-----------------------------------------------------------------------------*/
12889
12889
 
12890
12890
 
@@ -12928,13 +12928,16 @@ if(typeof(window)==="undefined") window=global;
12928
12928
  // https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications
12929
12929
 
12930
12930
  // We have to import both implementations, regardless of which one is chosen :
12931
- const {Socket}=require("socket.io");
12932
- const {WebSocket}=require("ws");
12931
+ //const {Socket}=require("socket.io");
12932
+ //const {WebSocket}=require("ws");
12933
+ Socket=require("socket.io");
12934
+ WebSocket=require("ws");
12935
+
12933
12936
 
12934
12937
 
12935
12938
  // DBG
12936
- console.log("Socket!!!!!!",Socket);
12937
- console.log("WebSocket!!!!!!",WebSocket);
12939
+ console.log("Socket!!!!!!>>>>",Socket);
12940
+ console.log("WebSocket!!!!!!>>>>",WebSocket);
12938
12941
 
12939
12942
 
12940
12943
  // =================================================================================
@@ -13106,6 +13109,8 @@ if(typeof(fs)==="undefined"){
13106
13109
  // NODE ONLY SERVER / CLIENTS :
13107
13110
  WebsocketImplementation={
13108
13111
 
13112
+ Socket:Socket,
13113
+ Websocket:WebSocket,
13109
13114
 
13110
13115
  isNodeContext:true,
13111
13116
  useSocketIOImplementation:false,
@@ -13139,8 +13144,10 @@ WebsocketImplementation={
13139
13144
  // *********************************************************************************
13140
13145
 
13141
13146
  // DBG
13142
- console.log("11111 Socket:",JSON.stringify(Socket));
13143
- console.log("11111 WebSocket:",JSON.stringify(WebSocket));
13147
+ console.log("11111 WebsocketImplementation.Socket:",WebsocketImplementation.Socket);
13148
+ console.log("11111 WebsocketImplementation.WebSocket:",WebsocketImplementation.WebSocket);
13149
+ console.log("11111 WebsocketImplementation.Socket:",JSON.stringify(WebsocketImplementation.Socket));
13150
+ console.log("11111 WebsocketImplementation.WebSocket:",JSON.stringify(WebsocketImplementation.WebSocket));
13144
13151
 
13145
13152
 
13146
13153
  return WebsocketImplementation;
@@ -13160,17 +13167,17 @@ WebsocketImplementation={
13160
13167
  // NODE SERVER MODE ONLY :
13161
13168
  let serverSocket;
13162
13169
  if(!WebsocketImplementation.useSocketIOImplementation){
13163
- serverSocket=new WebSocket.Server({ "server":listenableServer });
13170
+ serverSocket=new WebsocketImplementation.WebSocket.Server({ "server":listenableServer });
13164
13171
  }else{
13165
13172
 
13166
13173
 
13167
13174
  // DBG
13168
- console.log(">>>>>>>Socket:",JSON.stringify(Socket));
13169
- console.log(">>>>>>>WebSocket:",JSON.stringify(WebSocket));
13175
+ console.log(">>>>>>>WebsocketImplementation.Socket:",JSON.stringify(WebsocketImplementation.Socket));
13176
+ console.log(">>>>>>>WebsocketImplementation.WebSocket:",JSON.stringify(WebsocketImplementation.WebSocket));
13170
13177
 
13171
13178
  // NOW : socket.io :
13172
13179
  // Loading socket.io
13173
- serverSocket=Socket.listen(listenableServer);
13180
+ serverSocket=WebsocketImplementation.Socket.listen(listenableServer);
13174
13181
 
13175
13182
  // Setting up the disctonnect event :
13176
13183
  serverSocket.on("endConnection",()=>{
@@ -13258,7 +13265,7 @@ WebsocketImplementation={
13258
13265
 
13259
13266
 
13260
13267
  // TODO : FIXME : Use one single interface !
13261
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13268
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13262
13269
  else if(clientSocket.connected) return;
13263
13270
 
13264
13271
 
@@ -13282,7 +13289,7 @@ WebsocketImplementation={
13282
13289
 
13283
13290
  // TODO : FIXME : Use one single interface !
13284
13291
  let clientSocket=clientSocketParam;
13285
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13292
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13286
13293
  else if(clientSocket.connected) return;
13287
13294
 
13288
13295
 
@@ -13459,7 +13466,7 @@ WebsocketImplementation={
13459
13466
 
13460
13467
 
13461
13468
  // NEW : ws :
13462
- if(typeof(WebSocket)==="undefined"){
13469
+ if(typeof(WebsocketImplementation.WebSocket)==="undefined"){
13463
13470
  // TRACE
13464
13471
  lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
13465
13472
  return null;
@@ -13468,17 +13475,17 @@ WebsocketImplementation={
13468
13475
  // NODE CLIENT MODE ONLY :
13469
13476
  let clientSocket;
13470
13477
  if(!WebsocketImplementation.useSocketIOImplementation){
13471
- clientSocket=new WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
13478
+ clientSocket=new WebsocketImplementation.WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
13472
13479
  }else{
13473
13480
  // NOW : socket.io :
13474
13481
  //client on server-side:
13475
13482
 
13476
- if(WebsocketImplementation.isNodeContext && typeof(Socket)!=="undefined"){
13483
+ if(WebsocketImplementation.isNodeContext && typeof(WebsocketImplementation.Socket)!=="undefined"){
13477
13484
  // // Node client :
13478
13485
  // connectToServer=function (serverURL, port, isSecure, timeout=10000){
13479
- // return Socket.connect(serverURL + ":" + port,{timeout: timeout});
13486
+ // return WebsocketImplementation.Socket.connect(serverURL + ":" + port,{timeout: timeout});
13480
13487
  // }
13481
- clientSocket=Socket.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13488
+ clientSocket=WebsocketImplementation.Socket.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13482
13489
  }
13483
13490
  }
13484
13491
 
@@ -13538,7 +13545,7 @@ WebsocketImplementation={
13538
13545
  // console.log("(NODE CLIENT) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
13539
13546
 
13540
13547
  // TODO : FIXME : Use one single interface !
13541
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13548
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13542
13549
  else if(clientSocket.connected) return;
13543
13550
 
13544
13551
 
@@ -13615,7 +13622,7 @@ WebsocketImplementation={
13615
13622
  /*private*/connectToServerFromBrowser:(serverURL, port, isSecure, timeout)=>{
13616
13623
 
13617
13624
  // NEW : ws :
13618
- if(typeof(WebSocket)==="undefined"){
13625
+ if(typeof(WebsocketImplementation.WebSocket)==="undefined"){
13619
13626
  // TRACE
13620
13627
  lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
13621
13628
  return null;
@@ -13625,7 +13632,7 @@ WebsocketImplementation={
13625
13632
  // BROWSER CLIENT MODE ONLY :
13626
13633
  let clientSocket;
13627
13634
  if(!WebsocketImplementation.useSocketIOImplementation){
13628
- clientSocket=new WebSocket(serverURL+":"+port,["ws","wss"]);
13635
+ clientSocket=new WebsocketImplementation.WebSocket(serverURL+":"+port,["ws","wss"]);
13629
13636
  }else if(typeof(io)!=="undefined"){
13630
13637
  // NOW : socket.io :
13631
13638
  // // Browser client :
@@ -13691,7 +13698,7 @@ WebsocketImplementation={
13691
13698
  // console.log("(BROWSER) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
13692
13699
 
13693
13700
  // TODO : FIXME : Use one single interface !
13694
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
13701
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
13695
13702
  else if(clientSocket.connected) return;
13696
13703
 
13697
13704
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.110",
3
+ "version": "0.0.113",
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)",