aotrautils 0.0.148 → 0.0.151

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:46:41)»*/
3
+ /*utils COMMONS library associated with aotra version : «1.0.0.000 (17/07/2022-04:01:32)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4828,7 +4828,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4828
4828
 
4829
4829
 
4830
4830
 
4831
- /*utils CLIENT library associated with aotra version : «1.0.0.000 (17/07/2022-03:46:41)»*/
4831
+ /*utils CLIENT library associated with aotra version : «1.0.0.000 (17/07/2022-04:01:32)»*/
4832
4832
  /*-----------------------------------------------------------------------------*/
4833
4833
  /* ## Utility global methods in a browser (htmljs) client environment.
4834
4834
  *
@@ -11678,7 +11678,7 @@ createFusrodaClient=function(doOnClientReady, doOnDataReception, urlParam=null,
11678
11678
 
11679
11679
 
11680
11680
 
11681
- /*utils GEOMETRY library associated with aotra version : «1.0.0.000 (17/07/2022-03:46:41)»*/
11681
+ /*utils GEOMETRY library associated with aotra version : «1.0.0.000 (17/07/2022-04:01:32)»*/
11682
11682
  /*-----------------------------------------------------------------------------*/
11683
11683
 
11684
11684
 
@@ -12884,7 +12884,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
12884
12884
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
12885
12885
 
12886
12886
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
12887
- /*utils SERVER library associated with aotra version : «1.0.0.000 (17/07/2022-03:46:41)»*/
12887
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (17/07/2022-04:01:32)»*/
12888
12888
  /*-----------------------------------------------------------------------------*/
12889
12889
 
12890
12890
 
@@ -13233,7 +13233,15 @@ WebsocketImplementation={
13233
13233
 
13234
13234
  // dataWrapped=JSON.parse(dataWrapped);
13235
13235
  // dataWrapped=getAt(dataWrapped,0);// We get the root element
13236
- const dataWrapped=(WebsocketImplementation.useFlatStrings?JSON.parse(message):message);
13236
+
13237
+ let dataWrapped=message;
13238
+ try{
13239
+ dataWrapped=(WebsocketImplementation.useFlatStrings || isString(message)?JSON.parse(message):message);
13240
+ }catch(error1){
13241
+ // TRACE
13242
+ lognow(`ERROR : Failed to parse JSON for string «${dataWrapped}»`,error1);
13243
+ dataWrapped=(isString(message)?message:JSON.stringify(message));
13244
+ }
13237
13245
 
13238
13246
 
13239
13247
  // DBG
@@ -13277,16 +13285,9 @@ WebsocketImplementation={
13277
13285
 
13278
13286
 
13279
13287
  if(!WebsocketImplementation.useSocketIOImplementation) clientSocketParam.addEventListener("message", doOnMessage);
13280
- else{
13281
-
13282
- // DBG
13283
- clientSocketParam.onAny((event,args) => { console.log(`MAIS PUTAIN : ${event}:`,args); });
13284
- clientSocketParam.on(channelName,(args, clientSocket) => { console.log(`MAIS OSKOUR :${args} ${clientSocket}`); });
13285
-
13288
+ else clientSocketParam.on(channelName, doOnMessage);
13286
13289
 
13287
13290
 
13288
- clientSocketParam.on(channelName, doOnMessage);
13289
- }
13290
13291
 
13291
13292
 
13292
13293
 
@@ -13313,7 +13314,8 @@ WebsocketImplementation={
13313
13314
  // TODO : FIXME : Use one single interface !
13314
13315
  let serverClients;
13315
13316
  if(!WebsocketImplementation.useSocketIOImplementation) serverClients=nodeServerInstance.serverSocket.clients;
13316
- else serverClients=nodeServerInstance.serverSocket.sockets.clients();
13317
+ // OLD: else serverClients=nodeServerInstance.serverSocket.sockets.clients();
13318
+ else serverClients=nodeServerInstance.serverSocket.sockets;
13317
13319
 
13318
13320
  serverClients.forEach((clientSocket)=>{
13319
13321
 
@@ -13494,7 +13496,8 @@ WebsocketImplementation={
13494
13496
 
13495
13497
  // TODO : FIXME : Use one single interface !
13496
13498
  if(!WebsocketImplementation.useSocketIOImplementation) serverClients=nodeServerInstance.serverSocket.clients;
13497
- else serverClients=nodeServerInstance.serverSocket.sockets.clients();
13499
+ // OLD : else serverClients=nodeServerInstance.serverSocket.sockets.clients();
13500
+ else serverClients=nodeServerInstance.serverSocket.sockets;
13498
13501
 
13499
13502
  serverClients.forEach((clientSocket)=>{
13500
13503
  clearInterval(clientSocket.stateCheckInterval);
@@ -13733,7 +13736,17 @@ WebsocketImplementation={
13733
13736
  // const dataWrapped=JSON.parse(message);
13734
13737
  // dataWrapped=getAt(dataWrapped,0);// We get the root element
13735
13738
 
13736
- const dataWrapped=(WebsocketImplementation.useFlatStrings?JSON.parse(message):message);
13739
+
13740
+ let dataWrapped=message;
13741
+ try{
13742
+ dataWrapped=(WebsocketImplementation.useFlatStrings || isString(message)?JSON.parse(message):message);
13743
+ }catch(error1){
13744
+ // TRACE
13745
+ lognow(`ERROR : Failed to parse JSON for string «${dataWrapped}»`,error1);
13746
+ dataWrapped=(isString(message)?message:JSON.stringify(message));
13747
+ }
13748
+
13749
+
13737
13750
 
13738
13751
 
13739
13752
  // Channel information is stored in exchanged data :
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.148",
3
+ "version": "0.0.151",
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)",