aotrautils 0.0.326 → 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.
- aotrautils/aotrautils.build.js +38 -37
- aotrautils/package.json +1 -1
aotrautils/aotrautils.build.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (04/12/2022-
|
|
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-
|
|
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-
|
|
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-
|
|
14180
|
+
/*utils SERVER library associated with aotra version : «1_29072022-2359 (04/12/2022-13:37:53)»*/
|
|
14181
14181
|
/*-----------------------------------------------------------------------------*/
|
|
14182
14182
|
|
|
14183
14183
|
|
|
@@ -14534,18 +14534,19 @@ WebsocketImplementation={
|
|
|
14534
14534
|
clientPingIntervalMillis:5000,
|
|
14535
14535
|
// clientsSockets:[],
|
|
14536
14536
|
serverSocket:serverSocket,
|
|
14537
|
-
|
|
14537
|
+
receptionEntryPointsByClient:{},
|
|
14538
14538
|
|
|
14539
|
-
receive:(
|
|
14539
|
+
receive:(channelNameParam, doOnIncomingMessage, clientsRoomsTag=null)=>{
|
|
14540
14540
|
|
|
14541
14541
|
// DBG
|
|
14542
|
-
lognow("(SERVER) Registering receive for «"+
|
|
14542
|
+
lognow("(SERVER) Registering receive for «"+channelNameParam+"»...",doOnIncomingMessage);
|
|
14543
|
+
|
|
14543
14544
|
|
|
14544
14545
|
|
|
14545
14546
|
const receptionEntryPoint={
|
|
14546
|
-
channelName:
|
|
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
|
|
|
@@ -14569,7 +14570,7 @@ WebsocketImplementation={
|
|
|
14569
14570
|
|
|
14570
14571
|
|
|
14571
14572
|
// DBG
|
|
14572
|
-
lognow("(SERVER) ENTRY POINT IS OF THE RIGHT CHANNEL:", channelName);
|
|
14573
|
+
lognow("(SERVER) ENTRY POINT IS OF THE RIGHT CHANNEL:", receptionEntryPoint.channelName);
|
|
14573
14574
|
|
|
14574
14575
|
|
|
14575
14576
|
|
|
@@ -14591,12 +14592,11 @@ WebsocketImplementation={
|
|
|
14591
14592
|
};
|
|
14592
14593
|
|
|
14593
14594
|
|
|
14594
|
-
nodeServerInstance.
|
|
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
|
+
const clientId=getUUID();
|
|
14697
|
+
clientSocket.clientId=clientId;
|
|
14696
14698
|
|
|
14697
|
-
// DBG
|
|
14698
|
-
clientSocket.clientId=getUUID();
|
|
14699
|
-
|
|
14700
|
-
|
|
14701
|
-
// // DBG
|
|
14702
|
-
// console.log("nodeServerInstance.receptionEntryPoints.length:",nodeServerInstance.receptionEntryPoints.length);
|
|
14703
14699
|
|
|
14704
14700
|
|
|
14705
14701
|
const doOnMessage=(eventOrMessage)=>{
|
|
14706
14702
|
|
|
14707
14703
|
// We execute the events registration listeners entry points:
|
|
14708
|
-
|
|
14709
|
-
|
|
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 !
|
|
@@ -14890,10 +14891,10 @@ WebsocketImplementation={
|
|
|
14890
14891
|
|
|
14891
14892
|
receptionEntryPoints:[],
|
|
14892
14893
|
|
|
14893
|
-
receive:(
|
|
14894
|
+
receive:(channelNameParam, doOnIncomingMessage, clientsRoomsTag=null)=>{
|
|
14894
14895
|
|
|
14895
14896
|
const receptionEntryPoint={
|
|
14896
|
-
channelName:
|
|
14897
|
+
channelName:channelNameParam,
|
|
14897
14898
|
clientsRoomsTag:clientsRoomsTag,
|
|
14898
14899
|
execute:(eventOrMessage)=>{
|
|
14899
14900
|
|
|
@@ -14904,7 +14905,7 @@ WebsocketImplementation={
|
|
|
14904
14905
|
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
14905
14906
|
|
|
14906
14907
|
// Channel information is stored in exchanged data :
|
|
14907
|
-
if(dataWrapped.channelName && dataWrapped.channelName!==
|
|
14908
|
+
if(dataWrapped.channelName && dataWrapped.channelName!==channelNameParam) return;
|
|
14908
14909
|
|
|
14909
14910
|
const clientSocket=nodeClientInstance.clientSocket;
|
|
14910
14911
|
|
|
@@ -14924,7 +14925,7 @@ WebsocketImplementation={
|
|
|
14924
14925
|
},
|
|
14925
14926
|
|
|
14926
14927
|
|
|
14927
|
-
send:(
|
|
14928
|
+
send:(channelNameParam, data, clientsRoomsTag=null)=>{
|
|
14928
14929
|
|
|
14929
14930
|
const clientSocket=nodeClientInstance.clientSocket;
|
|
14930
14931
|
|
|
@@ -14941,7 +14942,7 @@ WebsocketImplementation={
|
|
|
14941
14942
|
if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
|
|
14942
14943
|
|
|
14943
14944
|
// Channel information is stored in exchanged data :
|
|
14944
|
-
let dataWrapped={channelName:
|
|
14945
|
+
let dataWrapped={channelName:channelNameParam, data:data};
|
|
14945
14946
|
|
|
14946
14947
|
|
|
14947
14948
|
// // DBG
|
|
@@ -14952,12 +14953,12 @@ WebsocketImplementation={
|
|
|
14952
14953
|
|
|
14953
14954
|
|
|
14954
14955
|
// // DBG
|
|
14955
|
-
// console.log("(NODE CLIENT) SENDING DATA !
|
|
14956
|
+
// console.log("(NODE CLIENT) SENDING DATA ! channelNameParam:«"+channelNameParam+"» ; clientsRoomsTag:«"+clientsRoomsTag+"»");
|
|
14956
14957
|
// console.log("(NODE CLIENT) SENDING DATA ! dataWrapped:",dataWrapped);
|
|
14957
14958
|
|
|
14958
14959
|
// TODO : FIXME : Use one single interface !
|
|
14959
14960
|
if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.send(dataWrapped);
|
|
14960
|
-
else clientSocket.emit(
|
|
14961
|
+
else clientSocket.emit(channelNameParam,dataWrapped);
|
|
14961
14962
|
|
|
14962
14963
|
return nodeClientInstance;
|
|
14963
14964
|
},
|
|
@@ -14995,7 +14996,7 @@ WebsocketImplementation={
|
|
|
14995
14996
|
|
|
14996
14997
|
const clientSocket=nodeClientInstance.clientSocket;
|
|
14997
14998
|
if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.addEventListener("message", doOnMessage);
|
|
14998
|
-
else clientSocket.on(
|
|
14999
|
+
else clientSocket.on(channelNameParam, doOnMessage);
|
|
14999
15000
|
|
|
15000
15001
|
doOnConnection(nodeClientInstance, clientSocket);
|
|
15001
15002
|
|
|
@@ -15061,10 +15062,10 @@ WebsocketImplementation={
|
|
|
15061
15062
|
const browserInstance={
|
|
15062
15063
|
clientSocket:clientSocket,
|
|
15063
15064
|
|
|
15064
|
-
receive:(
|
|
15065
|
+
receive:(channelNameParam, doOnIncomingMessage, clientsRoomsTag=null)=>{
|
|
15065
15066
|
|
|
15066
15067
|
// DBG
|
|
15067
|
-
lognow("INFO : (CLIENT-BROWSER) SETTING UP RECEIVE for :",
|
|
15068
|
+
lognow("INFO : (CLIENT-BROWSER) SETTING UP RECEIVE for :",channelNameParam);
|
|
15068
15069
|
|
|
15069
15070
|
|
|
15070
15071
|
const doOnMessage=(eventOrMessage)=>{
|
|
@@ -15076,7 +15077,7 @@ WebsocketImplementation={
|
|
|
15076
15077
|
|
|
15077
15078
|
|
|
15078
15079
|
// Channel information is stored in exchanged data :
|
|
15079
|
-
if(dataWrapped.channelName && dataWrapped.channelName!==
|
|
15080
|
+
if(dataWrapped.channelName && dataWrapped.channelName!==channelNameParam) return;
|
|
15080
15081
|
|
|
15081
15082
|
const clientSocket=browserInstance.clientSocket;
|
|
15082
15083
|
|
|
@@ -15089,14 +15090,14 @@ WebsocketImplementation={
|
|
|
15089
15090
|
|
|
15090
15091
|
|
|
15091
15092
|
if(!WebsocketImplementation.useSocketIOImplementation) browserInstance.clientSocket.addEventListener("message", doOnMessage);
|
|
15092
|
-
else browserInstance.clientSocket.on(
|
|
15093
|
+
else browserInstance.clientSocket.on(channelNameParam, doOnMessage);
|
|
15093
15094
|
|
|
15094
15095
|
|
|
15095
15096
|
return browserInstance;
|
|
15096
15097
|
},
|
|
15097
15098
|
|
|
15098
15099
|
|
|
15099
|
-
send:(
|
|
15100
|
+
send:(channelNameParam, data, clientsRoomsTag=null)=>{
|
|
15100
15101
|
|
|
15101
15102
|
const clientSocket=browserInstance.clientSocket;
|
|
15102
15103
|
|
|
@@ -15113,7 +15114,7 @@ WebsocketImplementation={
|
|
|
15113
15114
|
if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
|
|
15114
15115
|
|
|
15115
15116
|
// Channel information is stored in exchanged data :
|
|
15116
|
-
let dataWrapped={channelName:
|
|
15117
|
+
let dataWrapped={channelName:channelNameParam, data:data};
|
|
15117
15118
|
|
|
15118
15119
|
|
|
15119
15120
|
// DBG
|
|
@@ -15126,7 +15127,7 @@ WebsocketImplementation={
|
|
|
15126
15127
|
|
|
15127
15128
|
// TODO : FIXME : Use one single interface !
|
|
15128
15129
|
if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.send(dataWrapped);
|
|
15129
|
-
else clientSocket.emit(
|
|
15130
|
+
else clientSocket.emit(channelNameParam,dataWrapped);
|
|
15130
15131
|
|
|
15131
15132
|
|
|
15132
15133
|
return browserInstance;
|
aotrautils/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils",
|
|
3
|
-
"version": "0.0.
|
|
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)",
|