aotrautils 0.0.293 → 0.0.295

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 (27/11/2022-21:01:55)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (27/11/2022-22:10:56)»*/
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 (27/11/2022-21:01:55)»*/
4830
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (27/11/2022-22:10:56)»*/
4831
4831
  /*-----------------------------------------------------------------------------*/
4832
4832
  /* ## Utility global methods in a browser (htmljs) client environment.
4833
4833
  *
@@ -12948,7 +12948,7 @@ createOritaMicroClient=function(url, port, isNode=false){
12948
12948
  };
12949
12949
 
12950
12950
 
12951
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (27/11/2022-21:01:55)»*/
12951
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (27/11/2022-22:10:56)»*/
12952
12952
  /*-----------------------------------------------------------------------------*/
12953
12953
 
12954
12954
 
@@ -14176,7 +14176,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
14176
14176
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14177
14177
 
14178
14178
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14179
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (27/11/2022-21:01:55)»*/
14179
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (27/11/2022-22:10:56)»*/
14180
14180
  /*-----------------------------------------------------------------------------*/
14181
14181
 
14182
14182
 
@@ -14540,6 +14540,10 @@ WebsocketImplementation={
14540
14540
 
14541
14541
  receive:(channelName, doOnIncomingMessage, clientsRoomsTag=null)=>{
14542
14542
 
14543
+ // DBG
14544
+ lognow("(SERVER) Registering receive for «"+channelName+"»...",doOnIncomingMessage);
14545
+
14546
+
14543
14547
  const receptionEntryPoint={
14544
14548
  channelName:channelName,
14545
14549
  clientsRoomsTag:clientsRoomsTag,
@@ -14549,58 +14553,42 @@ WebsocketImplementation={
14549
14553
  // With «ws» library we have no choive than register message events inside a «connection» event !
14550
14554
  // nodeServerInstance.onConnectionToClient((serverParam, clientSocketParam)=>{
14551
14555
 
14552
- // TODO : Find a way to remove this !
14553
- const doOnMessage=(eventOrMessage)=>{
14554
-
14555
-
14556
- // DBG
14557
- lognow("(SERVER) RECEIVED SOMETHING FROM CLIENT...");
14558
-
14559
- // dataWrapped=JSON.parse(dataWrapped);
14560
- // dataWrapped=getAt(dataWrapped,0);// We get the root element
14561
-
14562
-
14563
- const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
14564
14556
 
14565
14557
 
14566
- // DBG
14567
- lognow("(SERVER) dataWrapped.channelName:",dataWrapped.channelName);
14568
- lognow("(SERVER) receptionEntryPoint.channelName:",receptionEntryPoint.channelName);
14569
-
14570
-
14571
- // Channel information is stored in exchanged data :
14572
- if(dataWrapped.channelName!==receptionEntryPoint.channelName) return;
14573
-
14574
-
14575
- const clientSocket=clientSocketParam;
14576
-
14577
-
14578
-
14579
- // TODO : FIXME : Use one single interface !
14580
- // Room information is stored in client socket object :
14581
- const isClientInRoom=WebsocketImplementation.isInRoom(clientSocket, receptionEntryPoint.clientsRoomsTag);
14582
-
14583
- // DBG
14584
- lognow("(SERVER) isClientInRoom:",isClientInRoom);
14585
-
14586
- if(!isClientInRoom) return;
14587
-
14588
- // DBG
14589
- lognow("(SERVER) doOnIncomingMessage:",doOnIncomingMessage);
14590
-
14591
- doOnIncomingMessage(dataWrapped.data, clientSocket);
14592
-
14593
- };
14594
-
14558
+ // DBG
14559
+ lognow("(SERVER) RECEIVED SOMETHING FROM CLIENT...");
14560
+
14561
+ // dataWrapped=JSON.parse(dataWrapped);
14562
+ // dataWrapped=getAt(dataWrapped,0);// We get the root element
14563
+
14595
14564
 
14565
+ const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
14596
14566
 
14597
-
14567
+
14568
+ // DBG
14569
+ lognow("(SERVER) dataWrapped.channelName:",dataWrapped.channelName);
14570
+ lognow("(SERVER) receptionEntryPoint.channelName:",receptionEntryPoint.channelName);
14571
+
14598
14572
 
14599
- if(!WebsocketImplementation.useSocketIOImplementation) clientSocketParam.addEventListener("message", doOnMessage);
14600
- else clientSocketParam.on(channelName, doOnMessage);
14573
+ // Channel information is stored in exchanged data :
14574
+ if(dataWrapped.channelName!==receptionEntryPoint.channelName) return;
14575
+
14601
14576
 
14577
+ const clientSocket=clientSocketParam;
14602
14578
 
14603
14579
 
14580
+ // TODO : FIXME : Use one single interface !
14581
+ // Room information is stored in client socket object :
14582
+ const isClientInRoom=WebsocketImplementation.isInRoom(clientSocket, receptionEntryPoint.clientsRoomsTag);
14583
+
14584
+ // DBG
14585
+ lognow("(SERVER) isClientInRoom:",isClientInRoom);
14586
+
14587
+ if(!isClientInRoom) return;
14588
+
14589
+ // DBG
14590
+ lognow("(SERVER) doOnIncomingMessage:",doOnIncomingMessage);
14591
+ if(doOnIncomingMessage) doOnIncomingMessage(dataWrapped.data, clientSocket);
14604
14592
 
14605
14593
 
14606
14594
  },
@@ -14703,15 +14691,38 @@ WebsocketImplementation={
14703
14691
  // console.log("nodeServerInstance.receptionEntryPoints.length:",nodeServerInstance.receptionEntryPoints.length);
14704
14692
 
14705
14693
 
14706
-
14707
- // We execute the events registration listeners entry points:
14708
- foreach(nodeServerInstance.receptionEntryPoints,(receptionEntryPoint,i)=>{
14709
-
14710
- // // DBG
14711
- // console.log("ENTRY POINT ["+i+"] !");
14712
-
14713
- receptionEntryPoint.execute(clientSocket);
14714
- });
14694
+
14695
+
14696
+ ////
14697
+
14698
+ doOnMessage=()=>{
14699
+
14700
+
14701
+
14702
+ // We execute the events registration listeners entry points:
14703
+ foreach(nodeServerInstance.receptionEntryPoints,(receptionEntryPoint,i)=>{
14704
+
14705
+ // DBG
14706
+ console.log("(SERVER) ENTRY POINT ["+i+"] is executed !");
14707
+
14708
+ receptionEntryPoint.execute(clientSocket);
14709
+ });
14710
+
14711
+ };
14712
+
14713
+
14714
+ if(!WebsocketImplementation.useSocketIOImplementation) clientSocketParam.addEventListener("message", doOnMessage);
14715
+ else clientSocketParam.on(channelName, doOnMessage);
14716
+
14717
+
14718
+
14719
+
14720
+
14721
+
14722
+
14723
+
14724
+
14725
+
14715
14726
 
14716
14727
 
14717
14728
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.293",
3
+ "version": "0.0.295",
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)",