aotrautils 0.0.303 → 0.0.305

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-23:10:28)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (01/12/2022-21:50:18)»*/
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-23:10:28)»*/
4830
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (01/12/2022-21:50:18)»*/
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-23:10:28)»*/
12951
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (01/12/2022-21:50:18)»*/
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-23:10:28)»*/
14179
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (01/12/2022-21:50:18)»*/
14180
14180
  /*-----------------------------------------------------------------------------*/
14181
14181
 
14182
14182
 
@@ -14547,13 +14547,9 @@ WebsocketImplementation={
14547
14547
  const receptionEntryPoint={
14548
14548
  channelName:channelName,
14549
14549
  clientsRoomsTag:clientsRoomsTag,
14550
- execute:(clientSocketParam, eventOrMessage)=>{
14550
+ execute:(eventOrMessage, clientSocketParam)=>{
14551
14551
 
14552
-
14553
14552
  // With «ws» library we have no choive than register message events inside a «connection» event !
14554
- // nodeServerInstance.onConnectionToClient((serverParam, clientSocketParam)=>{
14555
-
14556
-
14557
14553
 
14558
14554
  // DBG
14559
14555
  lognow("(SERVER) RECEIVED SOMETHING FROM CLIENT...", eventOrMessage.data);
@@ -14698,49 +14694,25 @@ WebsocketImplementation={
14698
14694
  clientSocket.clientId=getUUID();
14699
14695
 
14700
14696
 
14701
- // // DBG
14702
- // console.log("nodeServerInstance.receptionEntryPoints.length:",nodeServerInstance.receptionEntryPoints.length);
14703
-
14704
-
14697
+ // // DBG
14698
+ // console.log("nodeServerInstance.receptionEntryPoints.length:",nodeServerInstance.receptionEntryPoints.length);
14705
14699
 
14706
14700
 
14707
- ////
14701
+ const doOnMessage=(eventOrMessage)=>{
14708
14702
 
14709
- doOnMessage=(eventOrMessage)=>{
14710
-
14711
-
14712
14703
  // We execute the events registration listeners entry points:
14713
14704
  foreach(nodeServerInstance.receptionEntryPoints,(receptionEntryPoint,i)=>{
14714
-
14715
- // DBG
14716
- console.log("(SERVER) ENTRY POINT ["+i+"] is executed !");
14717
-
14718
- receptionEntryPoint.execute(clientSocket, eventOrMessage);
14705
+ receptionEntryPoint.execute(eventOrMessage, clientSocket);
14719
14706
  });
14720
14707
 
14721
14708
  };
14722
14709
 
14723
-
14724
14710
  if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.addEventListener("message", doOnMessage);
14725
14711
  else clientSocket.on(channelName, doOnMessage);
14726
14712
 
14727
-
14728
-
14729
-
14730
-
14731
-
14732
-
14733
-
14734
-
14735
-
14736
-
14737
-
14738
-
14739
14713
  doOnConnection(nodeServerInstance, clientSocket);
14740
14714
 
14741
14715
 
14742
-
14743
-
14744
14716
  // DBG
14745
14717
  lognow("DEBUG : Starting ping-pong with client : clientSocket.clientId:",clientSocket.clientId);
14746
14718
  lognow("DEBUG : clientSocket.readyState:",clientSocket.readyState);
@@ -14913,31 +14885,24 @@ WebsocketImplementation={
14913
14885
  const receptionEntryPoint={
14914
14886
  channelName:channelName,
14915
14887
  clientsRoomsTag:clientsRoomsTag,
14916
- execute:(clientSocketParam)=>{
14917
-
14918
- const doOnMessage=(eventOrMessage)=>{
14919
-
14920
- // dataWrapped=JSON.parse(dataWrapped);
14921
- // dataWrapped=getAt(dataWrapped,0);// We get the root element
14922
- // const dataWrapped=(WebsocketImplementation.useFlatStrings?JSON.parse(eventOrMessage):eventOrMessage);
14888
+ execute:(eventOrMessage)=>{
14923
14889
 
14924
- const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
14890
+ // dataWrapped=JSON.parse(dataWrapped);
14891
+ // dataWrapped=getAt(dataWrapped,0);// We get the root element
14892
+ // const dataWrapped=(WebsocketImplementation.useFlatStrings?JSON.parse(eventOrMessage):eventOrMessage);
14925
14893
 
14926
- // Channel information is stored in exchanged data :
14927
- if(dataWrapped.channelName && dataWrapped.channelName!==channelName) return;
14928
-
14929
- let clientSocket=nodeClientInstance.clientSocket;
14930
-
14931
- // Room information is stored in client socket object :
14932
- if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
14933
-
14934
- doOnIncomingMessage(dataWrapped.data, clientSocket);
14935
-
14936
- };
14894
+ const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
14895
+
14896
+ // Channel information is stored in exchanged data :
14897
+ if(dataWrapped.channelName && dataWrapped.channelName!==channelName) return;
14898
+
14899
+ const clientSocket=nodeClientInstance.clientSocket;
14900
+
14901
+ // Room information is stored in client socket object :
14902
+ if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
14903
+
14904
+ if(doOnIncomingMessage) doOnIncomingMessage(dataWrapped.data, clientSocket);
14937
14905
 
14938
- if(!WebsocketImplementation.useSocketIOImplementation) nodeClientInstance.clientSocket.addEventListener("message", doOnMessage);
14939
- else nodeClientInstance.clientSocket.on(channelName, doOnMessage);
14940
-
14941
14906
 
14942
14907
  }
14943
14908
  };
@@ -15006,18 +14971,23 @@ WebsocketImplementation={
15006
14971
  if(nodeClientInstance.hasConnectEventFired) return;
15007
14972
  nodeClientInstance.hasConnectEventFired=true;
15008
14973
 
15009
- const clientSocket=nodeClientInstance.clientSocket;
15010
-
15011
-
15012
14974
  // DBG
15013
14975
  lognow("DEBUG : CLIENT : doOnConnection !");
15014
14976
 
15015
- doOnConnection(nodeClientInstance, clientSocket);
14977
+ const doOnMessage=(eventOrMessage)=>{
14978
+
14979
+ // We execute the listeners entry points registration :
14980
+ foreach(nodeClientInstance.receptionEntryPoints,(receptionEntryPoint)=>{
14981
+ receptionEntryPoint.execute(eventOrMessage);
14982
+ });
14983
+
14984
+ };
15016
14985
 
15017
- // We execute the listeners entry points registration :
15018
- foreach(nodeClientInstance.receptionEntryPoints,(receptionEntryPoint)=>{
15019
- receptionEntryPoint.execute(clientSocket);
15020
- });
14986
+ const clientSocket=nodeClientInstance.clientSocket;
14987
+ if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.addEventListener("message", doOnMessage);
14988
+ else clientSocket.on(channelName, doOnMessage);
14989
+
14990
+ doOnConnection(nodeClientInstance, clientSocket);
15021
14991
 
15022
14992
 
15023
14993
  };
@@ -15088,30 +15058,30 @@ WebsocketImplementation={
15088
15058
  // DBG
15089
15059
  lognow("INFO : (CLIENT-BROWSER) SETTING UP RECEIVE for :",channelName);
15090
15060
 
15061
+
15091
15062
  const doOnMessage=(eventOrMessage)=>{
15092
15063
 
15093
-
15094
- const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
15095
-
15096
-
15097
- // Channel information is stored in exchanged data :
15098
- if(dataWrapped.channelName && dataWrapped.channelName!==channelName) return;
15099
-
15100
- let clientSocket=browserInstance.clientSocket;
15101
-
15102
- // Room information is stored in client socket object :
15103
- if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
15104
-
15105
- doOnIncomingMessage(dataWrapped.data, clientSocket);
15106
-
15107
- };
15064
+ const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
15065
+
15066
+
15067
+ // Channel information is stored in exchanged data :
15068
+ if(dataWrapped.channelName && dataWrapped.channelName!==channelName) return;
15069
+
15070
+ const clientSocket=browserInstance.clientSocket;
15071
+
15072
+ // Room information is stored in client socket object :
15073
+ if(!WebsocketImplementation.isInRoom(clientSocket, clientsRoomsTag)) return;
15074
+
15075
+ doOnIncomingMessage(dataWrapped.data, clientSocket);
15076
+
15077
+ };
15108
15078
 
15109
15079
 
15110
- if(!WebsocketImplementation.useSocketIOImplementation) browserInstance.clientSocket.addEventListener("message", doOnMessage);
15111
- else browserInstance.clientSocket.on(channelName, doOnMessage);
15080
+ if(!WebsocketImplementation.useSocketIOImplementation) browserInstance.clientSocket.addEventListener("message", doOnMessage);
15081
+ else browserInstance.clientSocket.on(channelName, doOnMessage);
15112
15082
 
15113
15083
 
15114
- return browserInstance;
15084
+ return browserInstance;
15115
15085
  },
15116
15086
 
15117
15087
 
@@ -15170,7 +15140,6 @@ WebsocketImplementation={
15170
15140
 
15171
15141
 
15172
15142
  doOnConnection(browserInstance, clientSocket);
15173
-
15174
15143
 
15175
15144
  };
15176
15145
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.303",
3
+ "version": "0.0.305",
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)",