aotrautils 0.0.72 → 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:25:54)»*/
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:25:54)»*/
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:25:54)»*/
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,32 +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
- const globalContext=(WebsocketImplementation.isNodeContext?global:window);
8289
- if(typeof(globalContext.socketIO)==="undefined"){
8290
- // TRACE
8291
- lognow("«socket.io» SERVER library not called yet, calling it now.");
8292
- globalContext.socketIO=require("socket.io");
8293
- // TRACE
8294
- lognow("«socket.io» SERVER library called:",globalContext.socketIO);
8295
-
8296
- }
8297
- if(typeof(globalContext.socketIO)==="undefined"){
8298
- // Exception
8299
- throw "ERROR : «socket.io» SERVER library not found. Cannot launch nodejs server. Aborting.";
8300
- }
8301
8324
  }else{
8302
8325
  // TRACE
8303
8326
  lognow("INFO : (SERVER/CLIENT) Using native websocket implementation.");
@@ -8306,23 +8329,7 @@ WebsocketImplementation={
8306
8329
 
8307
8330
  // *********************************************************************************
8308
8331
 
8309
- // NEW : ws :
8310
- // https://github.com/websockets/ws#installing
8311
- // https://github.com/websockets/ws/blob/master/doc/ws.md#event-message
8312
- // ON BROWSER SIDE : Native Websockets :
8313
- // https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
8314
- // https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications
8315
- if(typeof(WebSocket)==="undefined"){
8316
- WebSocket=require("ws");
8317
- // TRACE
8318
- console.log("«ws» SERVER library not called yet, calling it now.");
8319
- return WebsocketImplementation;
8320
- }
8321
- if(typeof(WebSocket)==="undefined"){
8322
- // TRACE
8323
- console.log("ERROR : «ws» SERVER library not found. Cannot launch nodejs server. Aborting.");
8324
- return null;
8325
- }
8332
+
8326
8333
 
8327
8334
  return WebsocketImplementation;
8328
8335
  },
@@ -8342,14 +8349,13 @@ WebsocketImplementation={
8342
8349
  serverSocket=new WebSocket.Server({ "server":listenableServer });
8343
8350
  }else{
8344
8351
 
8345
- const globalContext=(WebsocketImplementation.isNodeContext?global:window);
8346
8352
 
8347
8353
  // DBG
8348
- console.log(">>>>>>>socketIO:",JSON.stringify(globalContext.socketIO));
8354
+ console.log(">>>>>>>socketIO:",JSON.stringify(socketIO));
8349
8355
 
8350
8356
  // NOW : socket.io :
8351
8357
  // Loading socket.io
8352
- serverSocket=globalContext.socketIO.listen(listenableServer);
8358
+ serverSocket=socketIO.listen(listenableServer);
8353
8359
 
8354
8360
  // Setting up the disctonnect event :
8355
8361
  serverSocket.on("endConnection",()=>{
@@ -8652,14 +8658,13 @@ WebsocketImplementation={
8652
8658
  // NOW : socket.io :
8653
8659
  //client on server-side:
8654
8660
 
8655
- const globalContext=(WebsocketImplementation.isNodeContext?global:window);
8656
8661
 
8657
- if(WebsocketImplementation.isNodeContext && typeof(globalContext.socketIO)!=="undefined"){
8662
+ if(WebsocketImplementation.isNodeContext && typeof(socketIO)!=="undefined"){
8658
8663
  // // Node client :
8659
8664
  // connectToServer=function (serverURL, port, isSecure, timeout=10000){
8660
8665
  // return socketIO.connect(serverURL + ":" + port,{timeout: timeout});
8661
8666
  // }
8662
- clientSocket=globalContext.socketIO.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
8667
+ clientSocket=socketIO.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
8663
8668
  }
8664
8669
  }
8665
8670
 
@@ -9378,7 +9383,7 @@ function getListManager(config){
9378
9383
 
9379
9384
 
9380
9385
 
9381
- /*utils COMMONS library associated with aotra version : «1.0.0.000 (13/07/2022-02:25:54)»*/
9386
+ /*utils COMMONS library associated with aotra version : «1.0.0.000 (13/07/2022-09:28:34)»*/
9382
9387
  /*-----------------------------------------------------------------------------*/
9383
9388
 
9384
9389
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.72",
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)",