aotrautils-srv 0.0.510 → 0.0.512

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 (22/02/2023-01:16:00)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (07/03/2023-00:40:57)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4866,7 +4866,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4866
4866
 
4867
4867
 
4868
4868
 
4869
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (22/02/2023-01:16:00)»*/
4869
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (07/03/2023-00:40:57)»*/
4870
4870
  /*-----------------------------------------------------------------------------*/
4871
4871
 
4872
4872
 
@@ -5106,7 +5106,7 @@ WebsocketImplementation={
5106
5106
 
5107
5107
  // COMMON METHODS
5108
5108
  /*private static*/isInRoom(clientSocket, clientsRoomsTag){
5109
- return !clientsRoomsTag || empty(clientsRoomsTag) || contains(clientsRoomsTag, clientSocket.clientRoomTag);
5109
+ return (!clientsRoomsTag || empty(clientsRoomsTag) || contains(clientsRoomsTag, clientSocket.clientRoomTag));
5110
5110
  },
5111
5111
 
5112
5112
 
@@ -5462,12 +5462,12 @@ WebsocketImplementation={
5462
5462
  clientSocket.isConnectionAlive=false;
5463
5463
 
5464
5464
  // DBG
5465
- //lognow("(SERVER) SENDING PING");
5465
+ lognow("(SERVER) DEBUG : SENDING PING");
5466
5466
 
5467
5467
  if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.ping();
5468
5468
  // OLD :
5469
5469
  // else clientSocket.emit("ping");
5470
- else nodeServerInstance.send("protocol",{type:"ping"});
5470
+ else nodeServerInstance.send("protocol",{type:"ping"}, null, clientSocket);
5471
5471
 
5472
5472
 
5473
5473
  }, nodeServerInstance.clientPingIntervalMillis);
@@ -5855,10 +5855,9 @@ WebsocketImplementation={
5855
5855
 
5856
5856
  // We add a message id :
5857
5857
  const messageId=getUUID();
5858
-
5859
5858
  data.messageId=messageId;
5860
- browserInstance.send(channelNameParam, data, clientsRoomsTag);
5861
5859
 
5860
+ // 1) We prepare the reception :
5862
5861
  const resultPromise={
5863
5862
  clientsRoomsTag:clientsRoomsTag,
5864
5863
  messageId:messageId,
@@ -5867,6 +5866,8 @@ WebsocketImplementation={
5867
5866
 
5868
5867
  browserInstance.receive(channelNameForResponse, (dataLocal, clientSocket)=>{
5869
5868
 
5869
+
5870
+ // We check if the message matches the condition :
5870
5871
  if(listenerConfig.condition && !listenerConfig.condition(dataLocal, clientSocket)) return ;
5871
5872
 
5872
5873
  // We check if we have the same message id:
@@ -5881,6 +5882,9 @@ WebsocketImplementation={
5881
5882
  return resultPromise;
5882
5883
  }
5883
5884
  };
5885
+
5886
+ // 2) We send the data :
5887
+ browserInstance.send(channelNameParam, data, clientsRoomsTag);
5884
5888
 
5885
5889
 
5886
5890
  return resultPromise;
@@ -5991,16 +5995,6 @@ WebsocketImplementation={
5991
5995
 
5992
5996
 
5993
5997
 
5994
- if(WebsocketImplementation.useSocketIOImplementation){
5995
- browserInstance.receive("protocol",(message)=>{
5996
- if(message.type!=="ping") return;
5997
- browserInstance.send("protocol",{type:"pong"});
5998
-
5999
- // DBG
6000
- lognow("DEBUG : CLIENT : Pong sent.");
6001
- });
6002
- }
6003
-
6004
5998
 
6005
5999
  return browserInstance;
6006
6000
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.510",
3
+ "version": "0.0.512",
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)",