aotrautils-srv 0.0.151 → 0.0.154

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-03:43:04)»*/
3
+ /*utils COMMONS library associated with aotra version : «1.0.0.000 (17/07/2022-03:56:03)»*/
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-03:43:04)»*/
4831
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (17/07/2022-03:56:03)»*/
4832
4832
  /*-----------------------------------------------------------------------------*/
4833
4833
 
4834
4834
 
@@ -5177,12 +5177,21 @@ WebsocketImplementation={
5177
5177
 
5178
5178
  // dataWrapped=JSON.parse(dataWrapped);
5179
5179
  // dataWrapped=getAt(dataWrapped,0);// We get the root element
5180
- const dataWrapped=(WebsocketImplementation.useFlatStrings?JSON.parse(message):message);
5180
+
5181
+ let dataWrapped=message;
5182
+ try{
5183
+ dataWrapped=(WebsocketImplementation.useFlatStrings || isString(message)?JSON.parse(message):message);
5184
+ }catch(error1){
5185
+ // TRACE
5186
+ lognow(`ERROR : Failed to parse JSON for string «${dataWrapped}»`,error1);
5187
+ dataWrapped=(isString(message)?message:JSON.stringify(message));
5188
+ }
5181
5189
 
5182
5190
 
5183
5191
  // DBG
5184
5192
  lognow(" Channel information:dataWrapped",dataWrapped);
5185
- lognow(" Channel information:dataWrapped.channelName«"+receptionEntryPoint.channelName+"»");
5193
+ lognow(" Channel information:dataWrapped",JSON.stringify(dataWrapped));
5194
+ lognow(" Channel information:dataWrapped.channelName«"+dataWrapped.channelName+"»");
5186
5195
  lognow(" Channel information:receptionEntryPoint.channelName«"+receptionEntryPoint.channelName+"»");
5187
5196
  lognow(" C1",(dataWrapped.channelName!=receptionEntryPoint.channelName));
5188
5197
  lognow(" C2",(dataWrapped.channelName!==receptionEntryPoint.channelName));
@@ -5220,16 +5229,9 @@ WebsocketImplementation={
5220
5229
 
5221
5230
 
5222
5231
  if(!WebsocketImplementation.useSocketIOImplementation) clientSocketParam.addEventListener("message", doOnMessage);
5223
- else{
5224
-
5225
- // DBG
5226
- clientSocketParam.onAny((event,args) => { console.log(`MAIS PUTAIN : ${event}:`,args); });
5227
- clientSocketParam.on(channelName,(args, clientSocket) => { console.log(`MAIS OSKOUR :${args} ${clientSocket}`); });
5228
-
5232
+ else clientSocketParam.on(channelName, doOnMessage);
5229
5233
 
5230
5234
 
5231
- clientSocketParam.on(channelName, doOnMessage);
5232
- }
5233
5235
 
5234
5236
 
5235
5237
 
@@ -5676,7 +5678,17 @@ WebsocketImplementation={
5676
5678
  // const dataWrapped=JSON.parse(message);
5677
5679
  // dataWrapped=getAt(dataWrapped,0);// We get the root element
5678
5680
 
5679
- const dataWrapped=(WebsocketImplementation.useFlatStrings?JSON.parse(message):message);
5681
+
5682
+ let dataWrapped=message;
5683
+ try{
5684
+ dataWrapped=(WebsocketImplementation.useFlatStrings || isString(message)?JSON.parse(message):message);
5685
+ }catch(error1){
5686
+ // TRACE
5687
+ lognow(`ERROR : Failed to parse JSON for string «${dataWrapped}»`,error1);
5688
+ dataWrapped=(isString(message)?message:JSON.stringify(message));
5689
+ }
5690
+
5691
+
5680
5692
 
5681
5693
 
5682
5694
  // Channel information is stored in exchanged data :
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.151",
3
+ "version": "0.0.154",
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)",