aotrautils-srv 0.0.169 → 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,27 +5193,13 @@ 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
|
-
// DBG
|
|
5184
|
-
lognow(" SERVER RECEIVED 1:",message);
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
let dataWrapped=message;
|
|
5188
|
-
try{
|
|
5189
|
-
dataWrapped=(WebsocketImplementation.useFlatStrings || isString(message)?JSON.parse(message):message);
|
|
5190
|
-
}catch(error1){
|
|
5191
|
-
// TRACE
|
|
5192
|
-
lognow(`ERROR : Failed to parse JSON for string «${dataWrapped}»`,error1);
|
|
5193
|
-
dataWrapped=(isString(message)?message:JSON.stringify(message));
|
|
5194
|
-
}
|
|
5195
|
-
|
|
5196
|
-
|
|
5202
|
+
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
5197
5203
|
////
|
|
5198
5204
|
// DBG
|
|
5199
5205
|
lognow(" SERVER RECEIVED 2:",dataWrapped);
|
|
@@ -5423,7 +5429,6 @@ WebsocketImplementation={
|
|
|
5423
5429
|
nodeServerInstance.receive("protocol",(message, clientSocket)=>{
|
|
5424
5430
|
|
|
5425
5431
|
if(message.type!=="joinRoom" || !clientSocket) return;
|
|
5426
|
-
|
|
5427
5432
|
nodeServerInstance.addToRoom(clientSocket, message.clientRoomTag);
|
|
5428
5433
|
|
|
5429
5434
|
});
|
|
@@ -5510,13 +5515,13 @@ WebsocketImplementation={
|
|
|
5510
5515
|
clientsRoomsTag:clientsRoomsTag,
|
|
5511
5516
|
execute:(clientSocketParam)=>{
|
|
5512
5517
|
|
|
5513
|
-
const doOnMessage=(
|
|
5518
|
+
const doOnMessage=(eventOrMessage)=>{
|
|
5514
5519
|
|
|
5515
5520
|
// dataWrapped=JSON.parse(dataWrapped);
|
|
5516
5521
|
// dataWrapped=getAt(dataWrapped,0);// We get the root element
|
|
5517
|
-
|
|
5518
|
-
const dataWrapped=(WebsocketImplementation.useFlatStrings?JSON.parse(message):message);
|
|
5522
|
+
// const dataWrapped=(WebsocketImplementation.useFlatStrings?JSON.parse(eventOrMessage):eventOrMessage);
|
|
5519
5523
|
|
|
5524
|
+
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
5520
5525
|
|
|
5521
5526
|
// Channel information is stored in exchanged data :
|
|
5522
5527
|
if(dataWrapped.channelName && dataWrapped.channelName!==channelName) return;
|
|
@@ -5586,9 +5591,7 @@ WebsocketImplementation={
|
|
|
5586
5591
|
join:(clientRoomTag)=>{
|
|
5587
5592
|
// Join room client part protocol :
|
|
5588
5593
|
const message={type:"joinRoom",clientRoomTag:clientRoomTag};
|
|
5589
|
-
|
|
5590
5594
|
nodeClientInstance.send("protocol",message);
|
|
5591
|
-
|
|
5592
5595
|
},
|
|
5593
5596
|
|
|
5594
5597
|
|
|
@@ -5666,26 +5669,14 @@ WebsocketImplementation={
|
|
|
5666
5669
|
// DBG
|
|
5667
5670
|
lognow("INFO : (CLIENT-BROWSER) SETTING UP RECEIVE for :",channelName);
|
|
5668
5671
|
|
|
5669
|
-
const doOnMessage=(
|
|
5672
|
+
const doOnMessage=(eventOrMessage)=>{
|
|
5670
5673
|
|
|
5671
|
-
// // DBG
|
|
5672
|
-
// lognow("!!! RECEIVED : message",message);
|
|
5673
5674
|
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
let dataWrapped=message;
|
|
5680
|
-
try{
|
|
5681
|
-
dataWrapped=(WebsocketImplementation.useFlatStrings || isString(message)?JSON.parse(message):message);
|
|
5682
|
-
}catch(error1){
|
|
5683
|
-
// TRACE
|
|
5684
|
-
lognow(`ERROR : Failed to parse JSON for string «${dataWrapped}»`,error1);
|
|
5685
|
-
dataWrapped=(isString(message)?message:JSON.stringify(message));
|
|
5686
|
-
}
|
|
5687
|
-
|
|
5688
|
-
|
|
5675
|
+
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
5676
|
+
|
|
5677
|
+
////
|
|
5678
|
+
// DBG
|
|
5679
|
+
lognow(" CLIENT-BROWSER RECEIVED 2:",dataWrapped);
|
|
5689
5680
|
|
|
5690
5681
|
|
|
5691
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)",
|