aotrautils-srv 0.0.511 → 0.0.513
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 (
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (07/03/2023-01:07:38)»*/
|
|
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 (
|
|
4869
|
+
/*utils SERVER library associated with aotra version : «1_29072022-2359 (07/03/2023-01:07:38)»*/
|
|
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
|
|
|
@@ -5426,6 +5426,7 @@ WebsocketImplementation={
|
|
|
5426
5426
|
|
|
5427
5427
|
// DBG
|
|
5428
5428
|
lognow("DEBUG : Starting ping-pong with client : clientSocket.clientId:",clientSocket.clientId);
|
|
5429
|
+
lognow("DEBUG : WebsocketImplementation.useSocketIOImplementation:",WebsocketImplementation.useSocketIOImplementation);
|
|
5429
5430
|
lognow("DEBUG : clientSocket.readyState:",clientSocket.readyState);
|
|
5430
5431
|
|
|
5431
5432
|
|
|
@@ -5461,13 +5462,13 @@ WebsocketImplementation={
|
|
|
5461
5462
|
|
|
5462
5463
|
clientSocket.isConnectionAlive=false;
|
|
5463
5464
|
|
|
5464
|
-
// DBG
|
|
5465
|
-
|
|
5465
|
+
// // DBG
|
|
5466
|
+
// lognow("(SERVER) DEBUG : SENDING PING");
|
|
5466
5467
|
|
|
5467
5468
|
if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.ping();
|
|
5468
5469
|
// OLD :
|
|
5469
5470
|
// else clientSocket.emit("ping");
|
|
5470
|
-
else nodeServerInstance.send("protocol",{type:"ping"});
|
|
5471
|
+
else nodeServerInstance.send("protocol",{type:"ping"}, null, clientSocket);
|
|
5471
5472
|
|
|
5472
5473
|
|
|
5473
5474
|
}, nodeServerInstance.clientPingIntervalMillis);
|
|
@@ -5733,7 +5734,7 @@ WebsocketImplementation={
|
|
|
5733
5734
|
lognow("DEBUG : CLIENT : nodeClientInstance.clientSocket.on(connect)");
|
|
5734
5735
|
|
|
5735
5736
|
|
|
5736
|
-
// Node client ping handling :
|
|
5737
|
+
// Node client ping handling : (SocketIO implementation only)
|
|
5737
5738
|
if(WebsocketImplementation.useSocketIOImplementation){
|
|
5738
5739
|
nodeClientInstance.receive("protocol",(message)=>{
|
|
5739
5740
|
if(message.type!=="ping") return;
|
|
@@ -5855,10 +5856,9 @@ WebsocketImplementation={
|
|
|
5855
5856
|
|
|
5856
5857
|
// We add a message id :
|
|
5857
5858
|
const messageId=getUUID();
|
|
5858
|
-
|
|
5859
5859
|
data.messageId=messageId;
|
|
5860
|
-
browserInstance.send(channelNameParam, data, clientsRoomsTag);
|
|
5861
5860
|
|
|
5861
|
+
// 1) We prepare the reception :
|
|
5862
5862
|
const resultPromise={
|
|
5863
5863
|
clientsRoomsTag:clientsRoomsTag,
|
|
5864
5864
|
messageId:messageId,
|
|
@@ -5867,6 +5867,8 @@ WebsocketImplementation={
|
|
|
5867
5867
|
|
|
5868
5868
|
browserInstance.receive(channelNameForResponse, (dataLocal, clientSocket)=>{
|
|
5869
5869
|
|
|
5870
|
+
|
|
5871
|
+
// We check if the message matches the condition :
|
|
5870
5872
|
if(listenerConfig.condition && !listenerConfig.condition(dataLocal, clientSocket)) return ;
|
|
5871
5873
|
|
|
5872
5874
|
// We check if we have the same message id:
|
|
@@ -5881,6 +5883,9 @@ WebsocketImplementation={
|
|
|
5881
5883
|
return resultPromise;
|
|
5882
5884
|
}
|
|
5883
5885
|
};
|
|
5886
|
+
|
|
5887
|
+
// 2) We send the data :
|
|
5888
|
+
browserInstance.send(channelNameParam, data, clientsRoomsTag);
|
|
5884
5889
|
|
|
5885
5890
|
|
|
5886
5891
|
return resultPromise;
|
|
@@ -5972,7 +5977,7 @@ WebsocketImplementation={
|
|
|
5972
5977
|
|
|
5973
5978
|
|
|
5974
5979
|
|
|
5975
|
-
// Browser client ping handling :
|
|
5980
|
+
// Browser client ping handling : (SocketIO implementation only)
|
|
5976
5981
|
if(WebsocketImplementation.useSocketIOImplementation){
|
|
5977
5982
|
browserInstance.receive("protocol",(message)=>{
|
|
5978
5983
|
if(message.type!=="ping") return;
|
|
@@ -5991,16 +5996,6 @@ WebsocketImplementation={
|
|
|
5991
5996
|
|
|
5992
5997
|
|
|
5993
5998
|
|
|
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
5999
|
|
|
6005
6000
|
return browserInstance;
|
|
6006
6001
|
},
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.513",
|
|
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)",
|