aotrautils-srv 0.0.153 → 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:50:48)»*/
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:50:48)»*/
4831
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (17/07/2022-03:56:03)»*/
4832
4832
  /*-----------------------------------------------------------------------------*/
4833
4833
 
4834
4834
 
@@ -5229,16 +5229,9 @@ WebsocketImplementation={
5229
5229
 
5230
5230
 
5231
5231
  if(!WebsocketImplementation.useSocketIOImplementation) clientSocketParam.addEventListener("message", doOnMessage);
5232
- else{
5233
-
5234
- // DBG
5235
- clientSocketParam.onAny((event,args) => { console.log(`MAIS PUTAIN : ${event}:`,args); });
5236
- clientSocketParam.on(channelName,(args, clientSocket) => { console.log(`MAIS OSKOUR :${args} ${clientSocket}`); });
5232
+ else clientSocketParam.on(channelName, doOnMessage);
5237
5233
 
5238
5234
 
5239
-
5240
- clientSocketParam.on(channelName, doOnMessage);
5241
- }
5242
5235
 
5243
5236
 
5244
5237
 
@@ -5685,7 +5678,17 @@ WebsocketImplementation={
5685
5678
  // const dataWrapped=JSON.parse(message);
5686
5679
  // dataWrapped=getAt(dataWrapped,0);// We get the root element
5687
5680
 
5688
- 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
+
5689
5692
 
5690
5693
 
5691
5694
  // Channel information is stored in exchanged data :
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.153",
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)",