aotrautils 0.0.70 → 0.0.73

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 CLIENT library associated with aotra version : «1.0.0.000 (13/07/2022-02:19:46)»*/
3
+ /*utils CLIENT library associated with aotra version : «1.0.0.000 (13/07/2022-09:28:34)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
  /* ## Utility global methods in a browser (htmljs) client environment.
6
6
  *
@@ -6850,7 +6850,7 @@ createFusrodaClient=function(doOnClientReady, doOnDataReception, urlParam=null,
6850
6850
 
6851
6851
 
6852
6852
 
6853
- /*utils GEOMETRY library associated with aotra version : «1.0.0.000 (13/07/2022-02:19:46)»*/
6853
+ /*utils GEOMETRY library associated with aotra version : «1.0.0.000 (13/07/2022-09:28:34)»*/
6854
6854
  /*-----------------------------------------------------------------------------*/
6855
6855
 
6856
6856
 
@@ -8056,7 +8056,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
8056
8056
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
8057
8057
 
8058
8058
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
8059
- /*utils SERVER library associated with aotra version : «1.0.0.000 (13/07/2022-02:19:46)»*/
8059
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (13/07/2022-09:28:34)»*/
8060
8060
  /*-----------------------------------------------------------------------------*/
8061
8061
 
8062
8062
 
@@ -8086,6 +8086,45 @@ if(typeof(window)==="undefined") window=global;
8086
8086
 
8087
8087
 
8088
8088
 
8089
+ // OLD : socket.io :
8090
+ // https://stackoverflow.com/questions/31156884/how-to-use-https-on-node-js-using-express-socket-io
8091
+ // https://stackoverflow.com/questions/6599470/node-js-socket-io-with-ssl
8092
+ // https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener
8093
+
8094
+ if(typeof(socketIO)==="undefined"){
8095
+ // TRACE
8096
+ lognow("«socket.io» SERVER library not called yet, calling it now.");
8097
+ socketIO=require("socket.io");
8098
+ // TRACE
8099
+ lognow("«socket.io» SERVER library called:",socketIO);
8100
+
8101
+ }
8102
+ if(typeof(socketIO)==="undefined"){
8103
+ // Exception
8104
+ lognow("ERROR : «socket.io» SERVER library not found. Cannot launch nodejs server. Aborting.");
8105
+ }
8106
+
8107
+ // NEW : ws :
8108
+ // https://github.com/websockets/ws#installing
8109
+ // https://github.com/websockets/ws/blob/master/doc/ws.md#event-message
8110
+ // ON BROWSER SIDE : Native Websockets :
8111
+ // https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
8112
+ // https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications
8113
+ if(typeof(WebSocket)==="undefined"){
8114
+ WebSocket=require("ws");
8115
+ // TRACE
8116
+ console.log("«ws» SERVER library not called yet, calling it now.");
8117
+ }
8118
+ if(typeof(WebSocket)==="undefined"){
8119
+ // TRACE
8120
+ console.log("ERROR : «ws» SERVER library not found. Cannot launch nodejs server. Aborting.");
8121
+ }
8122
+
8123
+
8124
+
8125
+
8126
+
8127
+
8089
8128
  // =================================================================================
8090
8129
  // NODEJS UTILS
8091
8130
 
@@ -8272,31 +8311,16 @@ WebsocketImplementation={
8272
8311
 
8273
8312
  WebsocketImplementation.isNodeContext=isNodeContext;
8274
8313
 
8314
+ //const globalContext=(WebsocketImplementation.isNodeContext?global:window);
8315
+
8316
+
8275
8317
  // cf. https://socket.io/docs/v4/client-socket-instance/
8276
8318
  WebsocketImplementation.useSocketIOImplementation=useSocketIOImplementation;
8277
8319
 
8278
8320
  if(WebsocketImplementation.useSocketIOImplementation){
8279
-
8280
8321
  // TRACE
8281
8322
  lognow("INFO : (SERVER/CLIENT) Using socket.io websocket implementation.");
8282
8323
 
8283
- // OLD : socket.io :
8284
- // https://stackoverflow.com/questions/31156884/how-to-use-https-on-node-js-using-express-socket-io
8285
- // https://stackoverflow.com/questions/6599470/node-js-socket-io-with-ssl
8286
- // https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener
8287
-
8288
- if(typeof(socketIO)==="undefined"){
8289
- // TRACE
8290
- lognow("«socket.io» SERVER library not called yet, calling it now.");
8291
- socketIO=require("socket.io");
8292
- // TRACE
8293
- lognow("«socket.io» SERVER library called:",socketIO);
8294
-
8295
- }
8296
- if(typeof(socketIO)==="undefined"){
8297
- // Exception
8298
- throw "ERROR : «socket.io» SERVER library not found. Cannot launch nodejs server. Aborting.";
8299
- }
8300
8324
  }else{
8301
8325
  // TRACE
8302
8326
  lognow("INFO : (SERVER/CLIENT) Using native websocket implementation.");
@@ -8305,23 +8329,7 @@ WebsocketImplementation={
8305
8329
 
8306
8330
  // *********************************************************************************
8307
8331
 
8308
- // NEW : ws :
8309
- // https://github.com/websockets/ws#installing
8310
- // https://github.com/websockets/ws/blob/master/doc/ws.md#event-message
8311
- // ON BROWSER SIDE : Native Websockets :
8312
- // https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
8313
- // https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications
8314
- if(typeof(WebSocket)==="undefined"){
8315
- WebSocket=require("ws");
8316
- // TRACE
8317
- console.log("«ws» SERVER library not called yet, calling it now.");
8318
- return WebsocketImplementation;
8319
- }
8320
- if(typeof(WebSocket)==="undefined"){
8321
- // TRACE
8322
- console.log("ERROR : «ws» SERVER library not found. Cannot launch nodejs server. Aborting.");
8323
- return null;
8324
- }
8332
+
8325
8333
 
8326
8334
  return WebsocketImplementation;
8327
8335
  },
@@ -8341,7 +8349,7 @@ WebsocketImplementation={
8341
8349
  serverSocket=new WebSocket.Server({ "server":listenableServer });
8342
8350
  }else{
8343
8351
 
8344
-
8352
+
8345
8353
  // DBG
8346
8354
  console.log(">>>>>>>socketIO:",JSON.stringify(socketIO));
8347
8355
 
@@ -8649,6 +8657,8 @@ WebsocketImplementation={
8649
8657
  }else{
8650
8658
  // NOW : socket.io :
8651
8659
  //client on server-side:
8660
+
8661
+
8652
8662
  if(WebsocketImplementation.isNodeContext && typeof(socketIO)!=="undefined"){
8653
8663
  // // Node client :
8654
8664
  // connectToServer=function (serverURL, port, isSecure, timeout=10000){
@@ -9373,7 +9383,7 @@ function getListManager(config){
9373
9383
 
9374
9384
 
9375
9385
 
9376
- /*utils COMMONS library associated with aotra version : «1.0.0.000 (13/07/2022-02:19:46)»*/
9386
+ /*utils COMMONS library associated with aotra version : «1.0.0.000 (13/07/2022-09:28:34)»*/
9377
9387
  /*-----------------------------------------------------------------------------*/
9378
9388
 
9379
9389
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.70",
3
+ "version": "0.0.73",
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)",