aotrautils 0.0.327 → 0.0.328

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 (04/12/2022-02:54:41)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (04/12/2022-13:37:53)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4827,7 +4827,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4827
4827
 
4828
4828
 
4829
4829
 
4830
- /*utils CLIENT library associated with aotra version : «1_29072022-2359 (04/12/2022-02:54:41)»*/
4830
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (04/12/2022-13:37:53)»*/
4831
4831
  /*-----------------------------------------------------------------------------*/
4832
4832
  /* ## Utility global methods in a browser (htmljs) client environment.
4833
4833
  *
@@ -12949,7 +12949,7 @@ createOritaMicroClient=function(url, port, isNode=false){
12949
12949
  };
12950
12950
 
12951
12951
 
12952
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (04/12/2022-02:54:41)»*/
12952
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (04/12/2022-13:37:53)»*/
12953
12953
  /*-----------------------------------------------------------------------------*/
12954
12954
 
12955
12955
 
@@ -14177,7 +14177,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
14177
14177
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14178
14178
 
14179
14179
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14180
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (04/12/2022-02:54:41)»*/
14180
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (04/12/2022-13:37:53)»*/
14181
14181
  /*-----------------------------------------------------------------------------*/
14182
14182
 
14183
14183
 
@@ -14534,7 +14534,7 @@ WebsocketImplementation={
14534
14534
  clientPingIntervalMillis:5000,
14535
14535
  // clientsSockets:[],
14536
14536
  serverSocket:serverSocket,
14537
- receptionEntryPoints:[],
14537
+ receptionEntryPointsByClient:{},
14538
14538
 
14539
14539
  receive:(channelNameParam, doOnIncomingMessage, clientsRoomsTag=null)=>{
14540
14540
 
@@ -14542,10 +14542,11 @@ WebsocketImplementation={
14542
14542
  lognow("(SERVER) Registering receive for «"+channelNameParam+"»...",doOnIncomingMessage);
14543
14543
 
14544
14544
 
14545
+
14545
14546
  const receptionEntryPoint={
14546
14547
  channelName:channelNameParam,
14547
14548
  clientsRoomsTag:clientsRoomsTag,
14548
- execute:(eventOrMessage, clientSocketParam)=>{
14549
+ execute:(eventOrMessage, clientSocketParam, clientId)=>{
14549
14550
 
14550
14551
  // With «ws» library we have no choive than register message events inside a «connection» event !
14551
14552
 
@@ -14591,12 +14592,11 @@ WebsocketImplementation={
14591
14592
  };
14592
14593
 
14593
14594
 
14594
- nodeServerInstance.receptionEntryPoints.push(receptionEntryPoint);
14595
+ if(!nodeServerInstance.receptionEntryPointsByClient[clientId])
14596
+ nodeServerInstance.receptionEntryPointsByClient[clientId]=[];
14597
+ nodeServerInstance.receptionEntryPointsByClient[clientId].push(receptionEntryPoint);
14595
14598
 
14596
14599
 
14597
- // // DBG
14598
- // console.log("ADD RECEPTION ENTRY POINT channelName:«"+channelName+"»! nodeServerInstance.receptionEntryPoints.length:",nodeServerInstance.receptionEntryPoints.length);
14599
-
14600
14600
 
14601
14601
  return nodeServerInstance;
14602
14602
  },
@@ -14693,20 +14693,18 @@ WebsocketImplementation={
14693
14693
  // if(contains(nodeServerInstance.clientsSockets, clientSocket)) return;
14694
14694
  // nodeServerInstance.clientsSockets.push(clientSocket);
14695
14695
 
14696
-
14697
- // DBG
14698
- clientSocket.clientId=getUUID();
14696
+ const clientId=getUUID();
14697
+ clientSocket.clientId=clientId;
14699
14698
 
14700
14699
 
14701
- // // DBG
14702
- // console.log("nodeServerInstance.receptionEntryPoints.length:",nodeServerInstance.receptionEntryPoints.length);
14703
-
14704
14700
 
14705
14701
  const doOnMessage=(eventOrMessage)=>{
14706
14702
 
14707
14703
  // We execute the events registration listeners entry points:
14708
- foreach(nodeServerInstance.receptionEntryPoints,(receptionEntryPoint,i)=>{
14709
- receptionEntryPoint.execute(eventOrMessage, clientSocket);
14704
+ if(!nodeServerInstance.receptionEntryPointsByClient[clientId])
14705
+ return;
14706
+ foreach(nodeServerInstance.receptionEntryPointsByClient[clientId],(receptionEntryPoint,i)=>{
14707
+ receptionEntryPoint.execute(eventOrMessage, clientSocket, clientId);
14710
14708
  });
14711
14709
 
14712
14710
  };
@@ -14731,7 +14729,10 @@ WebsocketImplementation={
14731
14729
 
14732
14730
 
14733
14731
  // On today, this method is named as same for the two implementations :
14732
+ // TRACE
14733
+ lognow("(SERVER) Removing all listeners and receptjion entrypoints for client socket «"+clientSocket.clientId+"».");
14734
14734
  clientSocket.removeAllListeners();
14735
+ nodeServerInstance.receptionEntryPointsByClient[clientSocket.clientId]=[];
14735
14736
 
14736
14737
 
14737
14738
  // TODO : FIXME : Use one single interface !
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.327",
3
+ "version": "0.0.328",
4
4
  "main": "aotrautils.build.js",
5
5
  "description": "A library for vanilla javascript utils (client-side) used in aotra javascript CMS",
6
6
  "author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",