aotrautils-srv 0.0.1470 → 0.0.1472

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 (26/04/2025-02:18:29)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (26/04/2025-12:56:08)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4894,7 +4894,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4894
4894
 
4895
4895
 
4896
4896
 
4897
- /*utils AI library associated with aotra version : «1_29072022-2359 (26/04/2025-02:18:29)»*/
4897
+ /*utils AI library associated with aotra version : «1_29072022-2359 (26/04/2025-12:56:08)»*/
4898
4898
  /*-----------------------------------------------------------------------------*/
4899
4899
 
4900
4900
 
@@ -5040,7 +5040,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
5040
5040
 
5041
5041
 
5042
5042
 
5043
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (26/04/2025-02:18:29)»*/
5043
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (26/04/2025-12:56:08)»*/
5044
5044
  /*-----------------------------------------------------------------------------*/
5045
5045
 
5046
5046
 
@@ -6024,13 +6024,12 @@ WebsocketImplementation={
6024
6024
 
6025
6025
  // BROWSER CLIENT INSTANCE :
6026
6026
  const browserInstance={
6027
+
6027
6028
  clientSocket:clientSocket,
6028
-
6029
6029
  receptionEntryPoints:[],
6030
6030
 
6031
6031
  receive:(channelNameParam, doOnIncomingMessage, clientsRoomsTag=null, receptionEntryPointId=null, listenerConfig={destroyListenerAfterReceiving:false})=>{
6032
6032
 
6033
-
6034
6033
  // DBG
6035
6034
  lognow("INFO : (CLIENT-BROWSER) SETTING UP RECEIVE for :",channelNameParam);
6036
6035
 
@@ -6041,29 +6040,25 @@ WebsocketImplementation={
6041
6040
  // TODO : ADD TO ALL OTHER SUBSYSTEMS !
6042
6041
  id:receptionEntryPointId,
6043
6042
  listenerConfig:listenerConfig,
6043
+ doOnIncomingMessage:doOnIncomingMessage,
6044
6044
  execute:(eventOrMessage)=>{
6045
6045
 
6046
6046
  const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
6047
-
6048
- // // DBG
6049
- // lognow("(CLIENT) (DEBUG) CLIENT RECEIVED SOMETHING FROM SERVER :",dataWrapped);
6050
6047
 
6051
6048
  // Channel information is stored in exchanged data :
6052
- if(dataWrapped.channelName && dataWrapped.channelName!==channelNameParam) return;
6049
+ if(dataWrapped.channelName && dataWrapped.channelName!==this.channelName) return;
6053
6050
 
6054
- const clientSocket=browserInstance.clientSocket;
6055
-
6056
6051
  // Room information is stored in client socket object :
6057
- if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
6058
-
6059
- if(doOnIncomingMessage)
6060
- doOnIncomingMessage(dataWrapped.data, clientSocket);
6052
+ const clientSocket=browserInstance.clientSocket;
6053
+ if(!WebsocketImplementation.isInRoom(clientSocket, this.clientsRoomsTag)) return;
6061
6054
 
6062
6055
  // We remove one-time usage listeners :
6063
- if(listenerConfig && listenerConfig.destroyListenerAfterReceiving)
6064
- remove(browserInstance.receptionEntryPoints,receptionEntryPoint);
6056
+ // We remove BEFORE executing doOnIncomingMessage(), because in this function we can have other listener registration UNDER THE SAME ID !
6057
+ if(this.listenerConfig && this.listenerConfig.destroyListenerAfterReceiving)
6058
+ remove(browserInstance.receptionEntryPoints, receptionEntryPoint);
6065
6059
 
6066
-
6060
+ if(this.doOnIncomingMessage)
6061
+ this.doOnIncomingMessage(dataWrapped.data, clientSocket);
6067
6062
 
6068
6063
  }
6069
6064
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.1470",
3
+ "version": "0.0.1472",
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)",