aotrautils-srv 0.0.203 → 0.0.204

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 (19/07/2022-01:47:58)»*/
3
+ /*utils COMMONS library associated with aotra version : «1.0.0.000 (19/07/2022-02:12:38)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4828,7 +4828,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4828
4828
 
4829
4829
 
4830
4830
 
4831
- /*utils SERVER library associated with aotra version : «1.0.0.000 (19/07/2022-01:47:58)»*/
4831
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (19/07/2022-02:12:38)»*/
4832
4832
  /*-----------------------------------------------------------------------------*/
4833
4833
 
4834
4834
 
@@ -5353,8 +5353,12 @@ WebsocketImplementation={
5353
5353
  clientSocket.isAlive=false;
5354
5354
  try{
5355
5355
 
5356
- if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.ping();
5357
- else clientSocket.emit("ping");
5356
+ // OLD :
5357
+ // if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.ping();
5358
+ // else clientSocket.emit("ping");
5359
+ nodeServerInstance.send("protocol",{type:"ping"});
5360
+
5361
+
5358
5362
 
5359
5363
  }catch(error){
5360
5364
  lognow("ERROR : A problem occurred when tried to ping client socket : ",error);
@@ -5375,15 +5379,22 @@ WebsocketImplementation={
5375
5379
 
5376
5380
  }, nodeServerInstance.clientTimeoutMillis);
5377
5381
 
5378
- if(!WebsocketImplementation.useSocketIOImplementation){
5379
- clientSocket.on("pong",()=>{
5380
- clientSocket.isAlive=true;
5381
- });
5382
- }else{
5383
- clientSocket.on("ping",()=>{
5382
+
5383
+ // OLD :
5384
+ // if(!WebsocketImplementation.useSocketIOImplementation){
5385
+ // clientSocket.on("pong",()=>{
5386
+ // clientSocket.isAlive=true;
5387
+ // });
5388
+ // }else{
5389
+ // clientSocket.on("ping",()=>{
5390
+ // clientSocket.isAlive=true;
5391
+ // });
5392
+ // }
5393
+
5394
+ nodeServerInstance.receive("protocol",(message)=>{
5395
+ if(message.type!=="pong") return;
5384
5396
  clientSocket.isAlive=true;
5385
5397
  });
5386
- }
5387
5398
 
5388
5399
 
5389
5400
 
@@ -5603,12 +5614,25 @@ WebsocketImplementation={
5603
5614
  if(!WebsocketImplementation.useSocketIOImplementation) nodeClientInstance.clientSocket.addEventListener("open",doAllOnConnection);
5604
5615
  else nodeClientInstance.clientSocket.on("connect",doAllOnConnection);
5605
5616
 
5617
+
5606
5618
  },
5607
5619
 
5608
5620
 
5609
5621
  };
5610
5622
 
5611
5623
 
5624
+
5625
+ // CURRENT 3
5626
+ nodeClientInstance.receive("protocol",(message)=>{
5627
+ if(message.type!=="ping") return;
5628
+ nodeClientInstance.send("protocol",{type:"pong"});
5629
+
5630
+ // DBG
5631
+ lognow("DEBUG : CLIENT : Pong sent.");
5632
+ });
5633
+
5634
+
5635
+
5612
5636
  return nodeClientInstance;
5613
5637
  },
5614
5638
 
@@ -5742,6 +5766,18 @@ WebsocketImplementation={
5742
5766
  };
5743
5767
 
5744
5768
 
5769
+
5770
+
5771
+ // CURRENT 3
5772
+ browserInstance.receive("protocol",(message)=>{
5773
+ if(message.type!=="ping") return;
5774
+ browserInstance.send("protocol",{type:"pong"});
5775
+
5776
+ // DBG
5777
+ lognow("DEBUG : CLIENT : Pong sent.");
5778
+ });
5779
+
5780
+
5745
5781
  return browserInstance;
5746
5782
  },
5747
5783
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.203",
3
+ "version": "0.0.204",
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)",