aotrautils-srv 0.0.336 → 0.0.338

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:19)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (04/12/2022-18:51:56)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4827,7 +4827,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4827
4827
 
4828
4828
 
4829
4829
 
4830
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (04/12/2022-18:26:19)»*/
4830
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (04/12/2022-18:51:56)»*/
4831
4831
  /*-----------------------------------------------------------------------------*/
4832
4832
 
4833
4833
 
@@ -4984,6 +4984,14 @@ if(typeof(fs)==="undefined"){
4984
4984
  //Networking management :
4985
4985
  //- WEBSOCKETS AND NODEJS :
4986
4986
 
4987
+ function isConnected(clientSocket){
4988
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState===WebSocket.OPEN) return true;
4989
+ else if(clientSocket.connected) return true;
4990
+ return false;
4991
+ }
4992
+
4993
+
4994
+
4987
4995
  // -Server :
4988
4996
 
4989
4997
  getServerParams=function(portParam=null,certPathParam=null,keyPathParam=null){
@@ -5274,10 +5282,8 @@ WebsocketImplementation={
5274
5282
 
5275
5283
  serverClients.forEach((clientSocket)=>{
5276
5284
 
5277
- // TODO : FIXME : Use one single interface !
5278
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
5279
- else if(clientSocket.connected) return;
5280
-
5285
+
5286
+ if(!isConnected(clientSocket)) return;
5281
5287
 
5282
5288
 
5283
5289
  // Room information is stored in client socket object :
@@ -5528,7 +5534,7 @@ WebsocketImplementation={
5528
5534
  }
5529
5535
 
5530
5536
  // DBG
5531
- lognow("DEBUG : CLIENT : clientSocket created:"+clientSocket.connected);
5537
+ lognow("DEBUG : CLIENT : clientSocket created:");
5532
5538
 
5533
5539
 
5534
5540
  // NODE CLIENT INSTANCE :
@@ -5579,10 +5585,8 @@ WebsocketImplementation={
5579
5585
  // // DBG
5580
5586
  // console.log("(NODE CLIENT) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
5581
5587
 
5582
- // TODO : FIXME : Use one single interface !
5583
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
5584
- else if(clientSocket.connected) return;
5585
-
5588
+ if(!isConnected(clientSocket)) return;
5589
+
5586
5590
 
5587
5591
  // Room information is stored in client socket object :
5588
5592
  if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
@@ -5751,10 +5755,8 @@ WebsocketImplementation={
5751
5755
  // // DBG
5752
5756
  // console.log("(BROWSER) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
5753
5757
 
5754
- // TODO : FIXME : Use one single interface !
5755
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
5756
- else if(clientSocket.connected) return;
5757
-
5758
+ if(!isConnected(clientSocket)) return;
5759
+
5758
5760
 
5759
5761
  // Room information is stored in client socket object :
5760
5762
  if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.336",
3
+ "version": "0.0.338",
4
4
  "main": "aotrautils-srv.build.js",
5
5
  "description": "A library for vanilla javascript utils (server-side) used in aotra javascript CMS",
6
6
  "author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",