aotrautils-srv 0.0.456 → 0.0.457
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 (27/01/2023-22:17:44)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -4864,7 +4864,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
4864
4864
|
|
|
4865
4865
|
|
|
4866
4866
|
|
|
4867
|
-
/*utils SERVER library associated with aotra version : «1_29072022-2359 (
|
|
4867
|
+
/*utils SERVER library associated with aotra version : «1_29072022-2359 (27/01/2023-22:17:44)»*/
|
|
4868
4868
|
/*-----------------------------------------------------------------------------*/
|
|
4869
4869
|
|
|
4870
4870
|
|
|
@@ -5765,7 +5765,7 @@ WebsocketImplementation={
|
|
|
5765
5765
|
|
|
5766
5766
|
receptionEntryPoints:[],
|
|
5767
5767
|
|
|
5768
|
-
receive:(channelNameParam, doOnIncomingMessage, clientsRoomsTag=null, receptionEntryPointId=null)=>{
|
|
5768
|
+
receive:(channelNameParam, doOnIncomingMessage, clientsRoomsTag=null, receptionEntryPointId=null, listenerConfig={destroyListenerAfterReceiving:false})=>{
|
|
5769
5769
|
|
|
5770
5770
|
|
|
5771
5771
|
// DBG
|
|
@@ -5777,7 +5777,7 @@ WebsocketImplementation={
|
|
|
5777
5777
|
clientsRoomsTag:clientsRoomsTag,
|
|
5778
5778
|
// TODO : ADD TO ALL OTHER SUBSYSTEMS !
|
|
5779
5779
|
id:receptionEntryPointId,
|
|
5780
|
-
|
|
5780
|
+
listenerConfig:listenerConfig,
|
|
5781
5781
|
execute:(eventOrMessage)=>{
|
|
5782
5782
|
|
|
5783
5783
|
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
@@ -5793,9 +5793,11 @@ WebsocketImplementation={
|
|
|
5793
5793
|
// Room information is stored in client socket object :
|
|
5794
5794
|
if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
|
|
5795
5795
|
|
|
5796
|
-
if(doOnIncomingMessage)
|
|
5797
|
-
|
|
5796
|
+
if(doOnIncomingMessage)
|
|
5797
|
+
doOnIncomingMessage(dataWrapped.data, clientSocket);
|
|
5798
5798
|
|
|
5799
|
+
if(listenerConfig && listenerConfig.destroyListenerAfterReceiving)
|
|
5800
|
+
remove(browserInstance.receptionEntryPoints,receptionEntryPoint);
|
|
5799
5801
|
}
|
|
5800
5802
|
};
|
|
5801
5803
|
|
|
@@ -5803,6 +5805,8 @@ WebsocketImplementation={
|
|
|
5803
5805
|
if(!contains(browserInstance.receptionEntryPoints,(l)=>(l.id && receptionEntryPoint.id && l.id===receptionEntryPoint.id)))
|
|
5804
5806
|
browserInstance.receptionEntryPoints.push(receptionEntryPoint);
|
|
5805
5807
|
|
|
5808
|
+
// DBG
|
|
5809
|
+
lognow("browserInstance.receptionEntryPoints("+browserInstance.receptionEntryPoints.length+"):",browserInstance.receptionEntryPoints);
|
|
5806
5810
|
|
|
5807
5811
|
return browserInstance;
|
|
5808
5812
|
},
|
|
@@ -5820,18 +5824,32 @@ WebsocketImplementation={
|
|
|
5820
5824
|
// DBG
|
|
5821
5825
|
lognow(">>>>>>sendChainable("+channelNameParam+"):data:",data);
|
|
5822
5826
|
|
|
5827
|
+
// We add a message id :
|
|
5828
|
+
const messageId=getUUID();
|
|
5823
5829
|
|
|
5830
|
+
data.messageId=messageId;
|
|
5824
5831
|
browserInstance.send(channelNameParam, data, clientsRoomsTag);
|
|
5825
5832
|
|
|
5826
5833
|
const resultPromise={
|
|
5827
5834
|
clientsRoomsTag:clientsRoomsTag,
|
|
5835
|
+
messageId:messageId,
|
|
5828
5836
|
thenWhenReceiveMessageType:(channelNameForResponse, listenerConfig={messageType:"",condition:()=>true}, doOnIncomingMessageForResponse)=>{
|
|
5829
5837
|
const listenerId=nonull(listenerConfig.messageType,"");
|
|
5830
|
-
|
|
5838
|
+
|
|
5839
|
+
const self=this;
|
|
5840
|
+
browserInstance.receive(channelNameForResponse, (dataLocal, clientSocket)=>{
|
|
5841
|
+
|
|
5842
|
+
if(listenerConfig.condition && !listenerConfig.condition(dataLocal, clientSocket)) return ;
|
|
5843
|
+
|
|
5844
|
+
// We check if we have the same message id:
|
|
5845
|
+
if(self.messageId!==dataLocal.messageId){
|
|
5846
|
+
// DBG
|
|
5847
|
+
lognow("self.messageId:"+self.messageId+"|dataLocal.messageId"+dataLocal.messageId);
|
|
5848
|
+
return;
|
|
5849
|
+
}
|
|
5831
5850
|
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
}, this.clientsRoomsTag, listenerId);
|
|
5851
|
+
doOnIncomingMessageForResponse(dataLocal, clientSocket);
|
|
5852
|
+
}, this.clientsRoomsTag, listenerId, {destroyListenerAfterReceiving:true});
|
|
5835
5853
|
return this;
|
|
5836
5854
|
}
|
|
5837
5855
|
};
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.457",
|
|
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)",
|