aotrautils 0.0.102 → 0.0.105

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 (14/07/2022-00:12:59)»*/
3
+ /*utils COMMONS library associated with aotra version : «1.0.0.000 (16/07/2022-14:10:43)»*/
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 (14/07/2022-00:12:59)»*/
4831
+ /*utils CLIENT library associated with aotra version : «1.0.0.000 (16/07/2022-14:10:43)»*/
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 (14/07/2022-00:12:59)»*/
11681
+ /*utils GEOMETRY library associated with aotra version : «1.0.0.000 (16/07/2022-14:10:43)»*/
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 (14/07/2022-00:12:59)»*/
12887
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (16/07/2022-14:10:43)»*/
12888
12888
  /*-----------------------------------------------------------------------------*/
12889
12889
 
12890
12890
 
@@ -12918,46 +12918,20 @@ if(typeof(window)==="undefined") window=global;
12918
12918
  // https://stackoverflow.com/questions/31156884/how-to-use-https-on-node-js-using-express-socket-io
12919
12919
  // https://stackoverflow.com/questions/6599470/node-js-socket-io-with-ssl
12920
12920
  // https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener
12921
+ // https://socket.io/docs/v4/client-socket-instance/
12921
12922
 
12923
+ // NEW : ws :
12924
+ // https://github.com/websockets/ws#installing
12925
+ // https://github.com/websockets/ws/blob/master/doc/ws.md#event-message
12926
+ // ON BROWSER SIDE : Native Websockets :
12927
+ // https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
12928
+ // https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications
12922
12929
 
12923
-
12924
-
12925
- //let socketIO;
12926
- //let WebSocket;
12927
- //
12928
- //if(typeof(socketIO)==="undefined"){
12929
- // // TRACE
12930
- // lognow("«socket.io» SERVER library not called yet, calling it now.");
12931
- //
12932
- // socketIO=require("socket.io");
12933
- //// import { socketIO } from "socket.io";
12934
- //
12935
- // // TRACE
12936
- // lognow("«socket.io» SERVER library called:",socketIO);
12937
- //
12938
- //}
12939
- //if(typeof(socketIO)==="undefined"){
12940
- // // Exception
12941
- // lognow("ERROR : «socket.io» SERVER library not found. Cannot launch nodejs server. Aborting.");
12942
- //}
12943
- //
12944
- //// NEW : ws :
12945
- //// https://github.com/websockets/ws#installing
12946
- //// https://github.com/websockets/ws/blob/master/doc/ws.md#event-message
12947
- //// ON BROWSER SIDE : Native Websockets :
12948
- //// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
12949
- //// https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications
12950
- //if(typeof(WebSocket)==="undefined"){
12951
- // WebSocket=require("ws");
12952
- // // TRACE
12953
- // lognow("«ws» SERVER library not called yet, calling it now.");
12954
- //}
12955
- //if(typeof(WebSocket)==="undefined"){
12956
- // // TRACE
12957
- // lognow("ERROR : «ws» SERVER library not found. Cannot launch nodejs server. Aborting.");
12958
- //}
12959
-
12960
-
12930
+ // We have to import both implementations, regardless of which one is chosen :
12931
+ //const {Socket}=require("socket.io");
12932
+ //const {WebSocket}=require("ws");
12933
+ import { Socket } from "socket.io";
12934
+ import { WebSocket } from "ws";
12961
12935
 
12962
12936
 
12963
12937
 
@@ -13149,10 +13123,6 @@ WebsocketImplementation={
13149
13123
 
13150
13124
  WebsocketImplementation.isNodeContext=isNodeContext;
13151
13125
 
13152
- //const globalContext=(WebsocketImplementation.isNodeContext?global:window);
13153
-
13154
-
13155
- // cf. https://socket.io/docs/v4/client-socket-instance/
13156
13126
  WebsocketImplementation.useSocketIOImplementation=useSocketIOImplementation;
13157
13127
 
13158
13128
  if(WebsocketImplementation.useSocketIOImplementation){
@@ -13166,18 +13136,12 @@ WebsocketImplementation={
13166
13136
  }
13167
13137
 
13168
13138
  // *********************************************************************************
13169
-
13170
- socketIO=require("socket.io");
13171
- WebSocket=require("ws");
13172
-
13173
-
13174
13139
 
13175
13140
  // DBG
13176
- console.log("IIIII socketIO:",JSON.stringify(socketIO));
13141
+ console.log("IIIII Socket:",JSON.stringify(Socket));
13177
13142
  console.log("IIIII WebSocket:",JSON.stringify(WebSocket));
13178
13143
 
13179
13144
 
13180
-
13181
13145
  return WebsocketImplementation;
13182
13146
  },
13183
13147
 
@@ -13200,13 +13164,12 @@ WebsocketImplementation={
13200
13164
 
13201
13165
 
13202
13166
  // DBG
13203
- // console.log(">>>>>>>require(socket.io):",JSON.stringify(require("socket.io")));
13204
- console.log(">>>>>>>socketIO:",JSON.stringify(socketIO));
13167
+ console.log(">>>>>>>Socket:",JSON.stringify(Socket));
13205
13168
  console.log(">>>>>>>WebSocket:",JSON.stringify(WebSocket));
13206
13169
 
13207
13170
  // NOW : socket.io :
13208
13171
  // Loading socket.io
13209
- serverSocket=socketIO.listen(listenableServer);
13172
+ serverSocket=Socket.listen(listenableServer);
13210
13173
 
13211
13174
  // Setting up the disctonnect event :
13212
13175
  serverSocket.on("endConnection",()=>{
@@ -13509,13 +13472,12 @@ WebsocketImplementation={
13509
13472
  // NOW : socket.io :
13510
13473
  //client on server-side:
13511
13474
 
13512
-
13513
- if(WebsocketImplementation.isNodeContext && typeof(socketIO)!=="undefined"){
13475
+ if(WebsocketImplementation.isNodeContext && typeof(Socket)!=="undefined"){
13514
13476
  // // Node client :
13515
13477
  // connectToServer=function (serverURL, port, isSecure, timeout=10000){
13516
- // return socketIO.connect(serverURL + ":" + port,{timeout: timeout});
13478
+ // return Socket.connect(serverURL + ":" + port,{timeout: timeout});
13517
13479
  // }
13518
- clientSocket=socketIO.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13480
+ clientSocket=Socket.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
13519
13481
  }
13520
13482
  }
13521
13483
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.102",
3
+ "version": "0.0.105",
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)",