aotrautils 0.0.507 → 0.0.508
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 +59 -48
- 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 (05/02/2023-
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (05/02/2023-20:34:33)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -4866,7 +4866,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
4866
4866
|
|
|
4867
4867
|
|
|
4868
4868
|
|
|
4869
|
-
/*utils CLIENT library associated with aotra version : «1_29072022-2359 (05/02/2023-
|
|
4869
|
+
/*utils CLIENT library associated with aotra version : «1_29072022-2359 (05/02/2023-20:34:33)»*/
|
|
4870
4870
|
/*-----------------------------------------------------------------------------*/
|
|
4871
4871
|
/* ## Utility global methods in a browser (htmljs) client environment.
|
|
4872
4872
|
*
|
|
@@ -11434,7 +11434,7 @@ initClient=function(isNodeContext=true, useSocketIOImplementation=/*DEBUG*/false
|
|
|
11434
11434
|
aotraClient.client.start=function(){
|
|
11435
11435
|
|
|
11436
11436
|
// DBG
|
|
11437
|
-
lognow("INFO : Setting up
|
|
11437
|
+
lognow("INFO : Setting up client :...");
|
|
11438
11438
|
|
|
11439
11439
|
let socketToServer=WebsocketImplementation.getStatic(isNodeContext, useSocketIOImplementation).connectToServer(url, port, isSecure, timeout);
|
|
11440
11440
|
if(!socketToServer){
|
|
@@ -11487,7 +11487,7 @@ initClient=function(isNodeContext=true, useSocketIOImplementation=/*DEBUG*/false
|
|
|
11487
11487
|
// }
|
|
11488
11488
|
|
|
11489
11489
|
// DBG
|
|
11490
|
-
lognow("aotraClient.
|
|
11490
|
+
lognow("aotraClient.client:",aotraClient.client);
|
|
11491
11491
|
|
|
11492
11492
|
// DBG
|
|
11493
11493
|
// aotraClient.clientSocket.addEventListener("close",()=>{
|
|
@@ -11729,25 +11729,27 @@ createFusrodaClient=function(doOnClientReady, doOnDataReception, urlParam=null,
|
|
|
11729
11729
|
// DBG
|
|
11730
11730
|
lognow("FUSRODA CLIENT : SETTING UP...");
|
|
11731
11731
|
|
|
11732
|
+
|
|
11732
11733
|
//0)
|
|
11733
|
-
socketToServer.send("protocol", { type:"hello" });
|
|
11734
|
-
//1)
|
|
11735
11734
|
socketToServer.receive("protocolConfig", (messageConfig)=>{
|
|
11736
11735
|
|
|
11737
11736
|
// DBG
|
|
11738
|
-
lognow("(CLIENT) (DEBUG) Received protocol config from server
|
|
11737
|
+
lognow("(CLIENT) (DEBUG) Received protocol config from server : messageConfig:",messageConfig);
|
|
11739
11738
|
|
|
11740
11739
|
//2)
|
|
11741
|
-
socketToServer.send("screenFrameRequest", {});
|
|
11742
11740
|
socketToServer.receive("imagePacket", (doOnDataReception && doOnDataReception["image"]?doOnDataReception["image"]:()=>{/*DO NOTHING*/}));
|
|
11741
|
+
socketToServer.send("screenFrameRequest", {});
|
|
11743
11742
|
|
|
11744
11743
|
//2)
|
|
11745
|
-
socketToServer.send("soundSampleRequest", {});
|
|
11746
11744
|
socketToServer.receive("soundPacket", (doOnDataReception && doOnDataReception["sound"]?doOnDataReception["sound"]:()=>{/*DO NOTHING*/}));
|
|
11745
|
+
socketToServer.send("soundSampleRequest", {});
|
|
11747
11746
|
|
|
11748
11747
|
|
|
11749
11748
|
doOnClientReady(messageConfig);
|
|
11750
11749
|
});
|
|
11750
|
+
|
|
11751
|
+
//1)
|
|
11752
|
+
socketToServer.send("protocol", { type:"hello" });
|
|
11751
11753
|
|
|
11752
11754
|
|
|
11753
11755
|
}, urlParam, portParam, isSecure);
|
|
@@ -11910,7 +11912,7 @@ createOritaMainClient=function(
|
|
|
11910
11912
|
|
|
11911
11913
|
mainClient.outputsGPIO=outputsGPIOLocal;
|
|
11912
11914
|
|
|
11913
|
-
doOnOutputsUpdated(microClientId, mainClient.outputsGPIO);
|
|
11915
|
+
doOnOutputsUpdated(mainClient, microClientId, mainClient.outputsGPIO);
|
|
11914
11916
|
},
|
|
11915
11917
|
});
|
|
11916
11918
|
|
|
@@ -12028,7 +12030,7 @@ createOritaMainClient=function(
|
|
|
12028
12030
|
|
|
12029
12031
|
|
|
12030
12032
|
|
|
12031
|
-
treatVideoData();
|
|
12033
|
+
treatVideoData(microClientId, receivedData);
|
|
12032
12034
|
|
|
12033
12035
|
|
|
12034
12036
|
|
|
@@ -12052,7 +12054,7 @@ createOritaMainClient=function(
|
|
|
12052
12054
|
oritaClient.microClientsInfos[microClientId].lastTime=getNow();
|
|
12053
12055
|
|
|
12054
12056
|
|
|
12055
|
-
treatAudioData();
|
|
12057
|
+
treatAudioData(microClientId, receivedData);
|
|
12056
12058
|
|
|
12057
12059
|
|
|
12058
12060
|
}
|
|
@@ -12158,12 +12160,15 @@ createOritaMainClient=function(
|
|
|
12158
12160
|
|
|
12159
12161
|
|
|
12160
12162
|
|
|
12161
|
-
createOritaMicroClient=function(url, port, isNode=false){
|
|
12162
|
-
|
|
12163
|
+
createOritaMicroClient=function(url, port, isNode=false, staticMicroClientIdParam=null){
|
|
12163
12164
|
|
|
12165
|
+
|
|
12166
|
+
const staticMicroClientId=(!isNode?nonull(staticMicroClientIdParam,getURLParameter("mid")):null);
|
|
12164
12167
|
|
|
12165
12168
|
|
|
12166
|
-
|
|
12169
|
+
const oritaClient={
|
|
12170
|
+
|
|
12171
|
+
staticMicroClientId:staticMicroClientId,
|
|
12167
12172
|
|
|
12168
12173
|
onRegistrationEventListeners:[],
|
|
12169
12174
|
onCommunicationEventListeners:[],
|
|
@@ -12178,6 +12183,8 @@ createOritaMicroClient=function(url, port, isNode=false){
|
|
|
12178
12183
|
|
|
12179
12184
|
oritaClient.start = function(mediasArg = null) {
|
|
12180
12185
|
|
|
12186
|
+
|
|
12187
|
+
|
|
12181
12188
|
const startResultPromise = new Promise((resolve, reject) => {
|
|
12182
12189
|
|
|
12183
12190
|
|
|
@@ -12238,7 +12245,7 @@ createOritaMicroClient=function(url, port, isNode=false){
|
|
|
12238
12245
|
|
|
12239
12246
|
// Only micro client determines its own id ! (to avoid multi-registration protocol bug !)
|
|
12240
12247
|
|
|
12241
|
-
|
|
12248
|
+
const microClientId = nonull(oritaClient.staticMicroClientId, getUUID("short"));
|
|
12242
12249
|
|
|
12243
12250
|
oritaClient.microClientId = microClientId;
|
|
12244
12251
|
|
|
@@ -12264,7 +12271,7 @@ createOritaMicroClient=function(url, port, isNode=false){
|
|
|
12264
12271
|
|
|
12265
12272
|
if (contains(message.type, "response.microClient.registered")) {
|
|
12266
12273
|
|
|
12267
|
-
|
|
12274
|
+
const microClientId = message.microClientId;
|
|
12268
12275
|
|
|
12269
12276
|
// To be sure this registration response does not concerns another micro client :
|
|
12270
12277
|
if (oritaClient.microClientId !== microClientId) return;
|
|
@@ -12992,7 +12999,7 @@ createOritaMicroClient=function(url, port, isNode=false){
|
|
|
12992
12999
|
};
|
|
12993
13000
|
|
|
12994
13001
|
|
|
12995
|
-
/*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (05/02/2023-
|
|
13002
|
+
/*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (05/02/2023-20:34:33)»*/
|
|
12996
13003
|
/*-----------------------------------------------------------------------------*/
|
|
12997
13004
|
|
|
12998
13005
|
|
|
@@ -14220,7 +14227,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
|
|
|
14220
14227
|
// MUST REMAIN AT THE END OF THIS LIBRARY FILE !
|
|
14221
14228
|
|
|
14222
14229
|
AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
|
|
14223
|
-
/*utils SERVER library associated with aotra version : «1_29072022-2359 (05/02/2023-
|
|
14230
|
+
/*utils SERVER library associated with aotra version : «1_29072022-2359 (05/02/2023-20:34:33)»*/
|
|
14224
14231
|
/*-----------------------------------------------------------------------------*/
|
|
14225
14232
|
|
|
14226
14233
|
|
|
@@ -14383,9 +14390,9 @@ if(typeof(fs)==="undefined"){
|
|
|
14383
14390
|
//- WEBSOCKETS AND NODEJS :
|
|
14384
14391
|
|
|
14385
14392
|
function isConnected(clientSocket){
|
|
14386
|
-
if(!WebsocketImplementation.useSocketIOImplementation)
|
|
14387
|
-
|
|
14388
|
-
return
|
|
14393
|
+
if(!WebsocketImplementation.useSocketIOImplementation)
|
|
14394
|
+
return (clientSocket.readyState===WebSocket.OPEN)
|
|
14395
|
+
return (clientSocket.connected);
|
|
14389
14396
|
}
|
|
14390
14397
|
|
|
14391
14398
|
|
|
@@ -14650,6 +14657,14 @@ WebsocketImplementation={
|
|
|
14650
14657
|
|
|
14651
14658
|
nodeServerInstance.receptionEntryPoints.push(receptionEntryPoint);
|
|
14652
14659
|
|
|
14660
|
+
// SPECIAL FOR THE SOCKETIO IMPLEMENTATION :
|
|
14661
|
+
if(WebsocketImplementation.useSocketIOImplementation){
|
|
14662
|
+
const channelName=receptionEntryPoint.channelName;
|
|
14663
|
+
clientSocket.on(channelName, (eventOrMessage)=>{
|
|
14664
|
+
receptionEntryPoint.execute(eventOrMessage, clientSocket);
|
|
14665
|
+
});
|
|
14666
|
+
}
|
|
14667
|
+
|
|
14653
14668
|
|
|
14654
14669
|
// // DBG
|
|
14655
14670
|
// console.log("ADD RECEPTION ENTRY POINT channelName:«"+channelName+"»! nodeServerInstance.receptionEntryPoints.length:",nodeServerInstance.receptionEntryPoints.length);
|
|
@@ -14763,15 +14778,8 @@ WebsocketImplementation={
|
|
|
14763
14778
|
});
|
|
14764
14779
|
};
|
|
14765
14780
|
|
|
14766
|
-
if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.addEventListener("message", doOnMessage);
|
|
14767
|
-
else{
|
|
14781
|
+
if(!WebsocketImplementation.useSocketIOImplementation){ clientSocket.addEventListener("message", doOnMessage);
|
|
14768
14782
|
// NO: else clientSocket.on("message", doOnMessage);
|
|
14769
|
-
foreach(nodeServerInstance.receptionEntryPoints,(receptionEntryPoint,i)=>{
|
|
14770
|
-
const channelName=receptionEntryPoint.channelName;
|
|
14771
|
-
clientSocket.on(channelName, (eventOrMessage)=>{
|
|
14772
|
-
receptionEntryPoint.execute(eventOrMessage, clientSocket);
|
|
14773
|
-
});
|
|
14774
|
-
});
|
|
14775
14783
|
}
|
|
14776
14784
|
|
|
14777
14785
|
doOnConnection(nodeServerInstance, clientSocket);
|
|
@@ -14983,6 +14991,15 @@ WebsocketImplementation={
|
|
|
14983
14991
|
|
|
14984
14992
|
nodeClientInstance.receptionEntryPoints.push(receptionEntryPoint);
|
|
14985
14993
|
|
|
14994
|
+
// SPECIAL FOR THE SOCKETIO IMPLEMENTATION :
|
|
14995
|
+
if(WebsocketImplementation.useSocketIOImplementation){
|
|
14996
|
+
const channelName=receptionEntryPoint.channelName;
|
|
14997
|
+
clientSocket.on(channelName, (eventOrMessage)=>{
|
|
14998
|
+
receptionEntryPoint.execute(eventOrMessage, clientSocket);
|
|
14999
|
+
});
|
|
15000
|
+
}
|
|
15001
|
+
|
|
15002
|
+
|
|
14986
15003
|
return nodeClientInstance;
|
|
14987
15004
|
},
|
|
14988
15005
|
|
|
@@ -15060,15 +15077,8 @@ WebsocketImplementation={
|
|
|
15060
15077
|
};
|
|
15061
15078
|
|
|
15062
15079
|
const clientSocket=nodeClientInstance.clientSocket;
|
|
15063
|
-
if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.addEventListener("message", doOnMessage);
|
|
15064
|
-
else{
|
|
15080
|
+
if(!WebsocketImplementation.useSocketIOImplementation){ clientSocket.addEventListener("message", doOnMessage);
|
|
15065
15081
|
// NO: else clientSocket.on("message", doOnMessage);
|
|
15066
|
-
foreach(nodeClientInstance.receptionEntryPoints,(receptionEntryPoint,i)=>{
|
|
15067
|
-
const channelName=receptionEntryPoint.channelName;
|
|
15068
|
-
clientSocket.on(channelName, (eventOrMessage)=>{
|
|
15069
|
-
receptionEntryPoint.execute(eventOrMessage, clientSocket);
|
|
15070
|
-
});
|
|
15071
|
-
});
|
|
15072
15082
|
}
|
|
15073
15083
|
|
|
15074
15084
|
doOnConnection(nodeClientInstance, clientSocket);
|
|
@@ -15153,8 +15163,8 @@ WebsocketImplementation={
|
|
|
15153
15163
|
|
|
15154
15164
|
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
15155
15165
|
|
|
15156
|
-
//
|
|
15157
|
-
//
|
|
15166
|
+
// // DBG
|
|
15167
|
+
// lognow("(CLIENT) (DEBUG) CLIENT RECEIVED SOMETHING FROM SERVER :",dataWrapped);
|
|
15158
15168
|
|
|
15159
15169
|
// Channel information is stored in exchanged data :
|
|
15160
15170
|
if(dataWrapped.channelName && dataWrapped.channelName!==channelNameParam) return;
|
|
@@ -15181,6 +15191,14 @@ WebsocketImplementation={
|
|
|
15181
15191
|
if(!contains(browserInstance.receptionEntryPoints,(l)=>(l.id && receptionEntryPoint.id && l.id===receptionEntryPoint.id)))
|
|
15182
15192
|
browserInstance.receptionEntryPoints.push(receptionEntryPoint);
|
|
15183
15193
|
|
|
15194
|
+
// SPECIAL FOR THE SOCKETIO IMPLEMENTATION :
|
|
15195
|
+
if(WebsocketImplementation.useSocketIOImplementation){
|
|
15196
|
+
const channelName=receptionEntryPoint.channelName;
|
|
15197
|
+
clientSocket.on(channelName, (eventOrMessage)=>{
|
|
15198
|
+
receptionEntryPoint.execute(eventOrMessage, clientSocket);
|
|
15199
|
+
});
|
|
15200
|
+
}
|
|
15201
|
+
|
|
15184
15202
|
|
|
15185
15203
|
return browserInstance;
|
|
15186
15204
|
},
|
|
@@ -15302,15 +15320,8 @@ WebsocketImplementation={
|
|
|
15302
15320
|
};
|
|
15303
15321
|
|
|
15304
15322
|
const clientSocket=browserInstance.clientSocket;
|
|
15305
|
-
if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.addEventListener("message", doOnMessage);
|
|
15306
|
-
else{
|
|
15323
|
+
if(!WebsocketImplementation.useSocketIOImplementation){ clientSocket.addEventListener("message", doOnMessage);
|
|
15307
15324
|
// NO: else clientSocket.on("message", doOnMessage);
|
|
15308
|
-
foreach(browserInstance.receptionEntryPoints,(receptionEntryPoint,i)=>{
|
|
15309
|
-
const channelName=receptionEntryPoint.channelName;
|
|
15310
|
-
clientSocket.on(channelName, (eventOrMessage)=>{
|
|
15311
|
-
receptionEntryPoint.execute(eventOrMessage, clientSocket);
|
|
15312
|
-
});
|
|
15313
|
-
});
|
|
15314
15325
|
}
|
|
15315
15326
|
|
|
15316
15327
|
|
aotrautils/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.508",
|
|
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)",
|