aotrautils 0.0.340 → 0.0.342

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_29072022-2359 (04/12/2022-18:26:14)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (04/12/2022-18:51:53)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4827,7 +4827,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4827
4827
 
4828
4828
 
4829
4829
 
4830
- /*utils CLIENT library associated with aotra version : «1_29072022-2359 (04/12/2022-18:26:14)»*/
4830
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (04/12/2022-18:51:53)»*/
4831
4831
  /*-----------------------------------------------------------------------------*/
4832
4832
  /* ## Utility global methods in a browser (htmljs) client environment.
4833
4833
  *
@@ -11418,7 +11418,6 @@ initClient=function(isNodeContext=true, useSocketIOImplementation=/*DEBUG*/false
11418
11418
  // if(doOnError && useSocketIOImplementation /*TODO : FIXME: FOR NOW, ONLY WORKS FOR SOCKET.IO IMPLEMENTATION !'*/){
11419
11419
  //
11420
11420
  //// // DBG
11421
- //// lognow(">>> serverSocket.connected:"+serverSocket.connected);
11422
11421
  //// lognow(">>> serverSocket:",serverSocket);
11423
11422
  //
11424
11423
  //
@@ -12949,7 +12948,7 @@ createOritaMicroClient=function(url, port, isNode=false){
12949
12948
  };
12950
12949
 
12951
12950
 
12952
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (04/12/2022-18:26:14)»*/
12951
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (04/12/2022-18:51:53)»*/
12953
12952
  /*-----------------------------------------------------------------------------*/
12954
12953
 
12955
12954
 
@@ -14177,7 +14176,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
14177
14176
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14178
14177
 
14179
14178
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14180
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (04/12/2022-18:26:14)»*/
14179
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (04/12/2022-18:51:53)»*/
14181
14180
  /*-----------------------------------------------------------------------------*/
14182
14181
 
14183
14182
 
@@ -14334,6 +14333,14 @@ if(typeof(fs)==="undefined"){
14334
14333
  //Networking management :
14335
14334
  //- WEBSOCKETS AND NODEJS :
14336
14335
 
14336
+ function isConnected(clientSocket){
14337
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState===WebSocket.OPEN) return true;
14338
+ else if(clientSocket.connected) return true;
14339
+ return false;
14340
+ }
14341
+
14342
+
14343
+
14337
14344
  // -Server :
14338
14345
 
14339
14346
  getServerParams=function(portParam=null,certPathParam=null,keyPathParam=null){
@@ -14624,10 +14631,8 @@ WebsocketImplementation={
14624
14631
 
14625
14632
  serverClients.forEach((clientSocket)=>{
14626
14633
 
14627
- // TODO : FIXME : Use one single interface !
14628
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
14629
- else if(clientSocket.connected) return;
14630
-
14634
+
14635
+ if(!isConnected(clientSocket)) return;
14631
14636
 
14632
14637
 
14633
14638
  // Room information is stored in client socket object :
@@ -14878,7 +14883,7 @@ WebsocketImplementation={
14878
14883
  }
14879
14884
 
14880
14885
  // DBG
14881
- lognow("DEBUG : CLIENT : clientSocket created:"+clientSocket.connected);
14886
+ lognow("DEBUG : CLIENT : clientSocket created:");
14882
14887
 
14883
14888
 
14884
14889
  // NODE CLIENT INSTANCE :
@@ -14929,10 +14934,8 @@ WebsocketImplementation={
14929
14934
  // // DBG
14930
14935
  // console.log("(NODE CLIENT) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
14931
14936
 
14932
- // TODO : FIXME : Use one single interface !
14933
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
14934
- else if(clientSocket.connected) return;
14935
-
14937
+ if(!isConnected(clientSocket)) return;
14938
+
14936
14939
 
14937
14940
  // Room information is stored in client socket object :
14938
14941
  if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
@@ -15101,10 +15104,8 @@ WebsocketImplementation={
15101
15104
  // // DBG
15102
15105
  // console.log("(BROWSER) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
15103
15106
 
15104
- // TODO : FIXME : Use one single interface !
15105
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
15106
- else if(clientSocket.connected) return;
15107
-
15107
+ if(!isConnected(clientSocket)) return;
15108
+
15108
15109
 
15109
15110
  // Room information is stored in client socket object :
15110
15111
  if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.340",
3
+ "version": "0.0.342",
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)",