aotrautils-srv 0.0.337 → 0.0.339

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:41:30)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (04/12/2022-18:54:43)»*/
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:41:30)»*/
4830
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (04/12/2022-18:54:43)»*/
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,9 +5282,8 @@ WebsocketImplementation={
5274
5282
 
5275
5283
  serverClients.forEach((clientSocket)=>{
5276
5284
 
5277
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState===WebSocket.OPEN) clientSocket.isConnected=true;
5278
- else if(clientSocket.connected) clientSocket.isConnected=true;
5279
- if(!clientSocket.isConnected) return;
5285
+
5286
+ if(!isConnected(clientSocket)) return;
5280
5287
 
5281
5288
 
5282
5289
  // Room information is stored in client socket object :
@@ -5527,7 +5534,7 @@ WebsocketImplementation={
5527
5534
  }
5528
5535
 
5529
5536
  // DBG
5530
- lognow("DEBUG : CLIENT : clientSocket created:"+clientSocket.isConnected);
5537
+ lognow("DEBUG : CLIENT : clientSocket created:");
5531
5538
 
5532
5539
 
5533
5540
  // NODE CLIENT INSTANCE :
@@ -5578,9 +5585,7 @@ WebsocketImplementation={
5578
5585
  // // DBG
5579
5586
  // console.log("(NODE CLIENT) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
5580
5587
 
5581
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState===WebSocket.OPEN) clientSocket.isConnected=true;
5582
- else if(clientSocket.connected) clientSocket.isConnected=true;
5583
- if(!clientSocket.isConnected) return;
5588
+ if(!isConnected(clientSocket)) return;
5584
5589
 
5585
5590
 
5586
5591
  // Room information is stored in client socket object :
@@ -5750,9 +5755,7 @@ WebsocketImplementation={
5750
5755
  // // DBG
5751
5756
  // console.log("(BROWSER) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
5752
5757
 
5753
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState===WebSocket.OPEN) clientSocket.isConnected=true;
5754
- else if(clientSocket.connected) clientSocket.isConnected=true;
5755
- if(!clientSocket.isConnected) return;
5758
+ if(!isConnected(clientSocket)) return;
5756
5759
 
5757
5760
 
5758
5761
  // Room information is stored in client socket object :
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.337",
3
+ "version": "0.0.339",
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)",