aotrautils-srv 0.0.167 → 0.0.170
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.0.0.000 (17/07/2022-14:
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1.0.0.000 (17/07/2022-14:45:40)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -4828,7 +4828,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
4828
4828
|
|
|
4829
4829
|
|
|
4830
4830
|
|
|
4831
|
-
/*utils SERVER library associated with aotra version : «1.0.0.000 (17/07/2022-14:
|
|
4831
|
+
/*utils SERVER library associated with aotra version : «1.0.0.000 (17/07/2022-14:45:40)»*/
|
|
4832
4832
|
/*-----------------------------------------------------------------------------*/
|
|
4833
4833
|
|
|
4834
4834
|
|
|
@@ -5113,6 +5113,26 @@ WebsocketImplementation={
|
|
|
5113
5113
|
},
|
|
5114
5114
|
|
|
5115
5115
|
|
|
5116
|
+
/*private*/getMessageDataBothImplementations:(eventOrMessage)=>{
|
|
5117
|
+
|
|
5118
|
+
const dataResult=(!WebsocketImplementation.useSocketIOImplementation?eventOrMessage.data:eventOrMessage);
|
|
5119
|
+
|
|
5120
|
+
////
|
|
5121
|
+
// DBG
|
|
5122
|
+
lognow(" SERVER RECEIVED 1:",eventOrMessage);
|
|
5123
|
+
|
|
5124
|
+
try{
|
|
5125
|
+
dataResult=(WebsocketImplementation.useFlatStrings || isString(eventOrMessage)?JSON.parse(eventOrMessage):eventOrMessage);
|
|
5126
|
+
}catch(error1){
|
|
5127
|
+
// TRACE
|
|
5128
|
+
lognow(`ERROR : Failed to parse JSON for string «${dataResult}»`,error1);
|
|
5129
|
+
dataResult=(isString(eventOrMessage)?eventOrMessage:JSON.stringify(eventOrMessage));
|
|
5130
|
+
}
|
|
5131
|
+
|
|
5132
|
+
return dataResult;
|
|
5133
|
+
},
|
|
5134
|
+
|
|
5135
|
+
|
|
5116
5136
|
getServer:(listenableServer)=>{
|
|
5117
5137
|
|
|
5118
5138
|
if(!WebsocketImplementation.isNodeContext){
|
|
@@ -5173,21 +5193,18 @@ WebsocketImplementation={
|
|
|
5173
5193
|
// nodeServerInstance.onConnectionToClient((serverParam, clientSocketParam)=>{
|
|
5174
5194
|
|
|
5175
5195
|
// TODO : Find a way to remove this !
|
|
5176
|
-
const doOnMessage=(
|
|
5196
|
+
const doOnMessage=(eventOrMessage)=>{
|
|
5177
5197
|
|
|
5178
5198
|
// dataWrapped=JSON.parse(dataWrapped);
|
|
5179
5199
|
// dataWrapped=getAt(dataWrapped,0);// We get the root element
|
|
5200
|
+
|
|
5180
5201
|
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
dataWrapped=(isString(message)?message:JSON.stringify(message));
|
|
5188
|
-
}
|
|
5189
|
-
|
|
5190
|
-
|
|
5202
|
+
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
5203
|
+
////
|
|
5204
|
+
// DBG
|
|
5205
|
+
lognow(" SERVER RECEIVED 2:",dataWrapped);
|
|
5206
|
+
|
|
5207
|
+
|
|
5191
5208
|
|
|
5192
5209
|
// Channel information is stored in exchanged data :
|
|
5193
5210
|
if(dataWrapped.channelName!==receptionEntryPoint.channelName) return;
|
|
@@ -5412,7 +5429,6 @@ WebsocketImplementation={
|
|
|
5412
5429
|
nodeServerInstance.receive("protocol",(message, clientSocket)=>{
|
|
5413
5430
|
|
|
5414
5431
|
if(message.type!=="joinRoom" || !clientSocket) return;
|
|
5415
|
-
|
|
5416
5432
|
nodeServerInstance.addToRoom(clientSocket, message.clientRoomTag);
|
|
5417
5433
|
|
|
5418
5434
|
});
|
|
@@ -5499,13 +5515,13 @@ WebsocketImplementation={
|
|
|
5499
5515
|
clientsRoomsTag:clientsRoomsTag,
|
|
5500
5516
|
execute:(clientSocketParam)=>{
|
|
5501
5517
|
|
|
5502
|
-
const doOnMessage=(
|
|
5518
|
+
const doOnMessage=(eventOrMessage)=>{
|
|
5503
5519
|
|
|
5504
5520
|
// dataWrapped=JSON.parse(dataWrapped);
|
|
5505
5521
|
// dataWrapped=getAt(dataWrapped,0);// We get the root element
|
|
5506
|
-
|
|
5507
|
-
const dataWrapped=(WebsocketImplementation.useFlatStrings?JSON.parse(message):message);
|
|
5522
|
+
// const dataWrapped=(WebsocketImplementation.useFlatStrings?JSON.parse(eventOrMessage):eventOrMessage);
|
|
5508
5523
|
|
|
5524
|
+
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
5509
5525
|
|
|
5510
5526
|
// Channel information is stored in exchanged data :
|
|
5511
5527
|
if(dataWrapped.channelName && dataWrapped.channelName!==channelName) return;
|
|
@@ -5575,9 +5591,7 @@ WebsocketImplementation={
|
|
|
5575
5591
|
join:(clientRoomTag)=>{
|
|
5576
5592
|
// Join room client part protocol :
|
|
5577
5593
|
const message={type:"joinRoom",clientRoomTag:clientRoomTag};
|
|
5578
|
-
|
|
5579
5594
|
nodeClientInstance.send("protocol",message);
|
|
5580
|
-
|
|
5581
5595
|
},
|
|
5582
5596
|
|
|
5583
5597
|
|
|
@@ -5655,26 +5669,14 @@ WebsocketImplementation={
|
|
|
5655
5669
|
// DBG
|
|
5656
5670
|
lognow("INFO : (CLIENT-BROWSER) SETTING UP RECEIVE for :",channelName);
|
|
5657
5671
|
|
|
5658
|
-
const doOnMessage=(
|
|
5672
|
+
const doOnMessage=(eventOrMessage)=>{
|
|
5659
5673
|
|
|
5660
|
-
// // DBG
|
|
5661
|
-
// lognow("!!! RECEIVED : message",message);
|
|
5662
5674
|
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
let dataWrapped=message;
|
|
5669
|
-
try{
|
|
5670
|
-
dataWrapped=(WebsocketImplementation.useFlatStrings || isString(message)?JSON.parse(message):message);
|
|
5671
|
-
}catch(error1){
|
|
5672
|
-
// TRACE
|
|
5673
|
-
lognow(`ERROR : Failed to parse JSON for string «${dataWrapped}»`,error1);
|
|
5674
|
-
dataWrapped=(isString(message)?message:JSON.stringify(message));
|
|
5675
|
-
}
|
|
5676
|
-
|
|
5677
|
-
|
|
5675
|
+
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
5676
|
+
|
|
5677
|
+
////
|
|
5678
|
+
// DBG
|
|
5679
|
+
lognow(" CLIENT-BROWSER RECEIVED 2:",dataWrapped);
|
|
5678
5680
|
|
|
5679
5681
|
|
|
5680
5682
|
// Channel information is stored in exchanged data :
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.170",
|
|
4
4
|
"main": "aotrautils-srv.build.js",
|
|
5
5
|
"description": "A library for vanilla javascript utils (server-side) used in aotra javascript CMS",
|
|
6
6
|
"author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",
|