aotrautils-srv 0.0.114 → 0.0.115

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 (16/07/2022-14:36:04)»*/
3
+ /*utils COMMONS library associated with aotra version : «1.0.0.000 (16/07/2022-14:41:38)»*/
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 (16/07/2022-14:36:04)»*/
4831
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (16/07/2022-14:41:38)»*/
4832
4832
  /*-----------------------------------------------------------------------------*/
4833
4833
 
4834
4834
 
@@ -4877,8 +4877,8 @@ const {WebSocket}=require("ws");
4877
4877
 
4878
4878
 
4879
4879
  // DBG
4880
- console.log("Socket!!!!!!",Socket);
4881
- console.log("WebSocket!!!!!!",WebSocket);
4880
+ console.log("Socket!!!!!!>>>>",Socket);
4881
+ console.log("WebSocket!!!!!!>>>>",WebSocket);
4882
4882
 
4883
4883
 
4884
4884
  // =================================================================================
@@ -5050,6 +5050,8 @@ if(typeof(fs)==="undefined"){
5050
5050
  // NODE ONLY SERVER / CLIENTS :
5051
5051
  WebsocketImplementation={
5052
5052
 
5053
+ Socket:Socket,
5054
+ Websocket:WebSocket,
5053
5055
 
5054
5056
  isNodeContext:true,
5055
5057
  useSocketIOImplementation:false,
@@ -5083,8 +5085,8 @@ WebsocketImplementation={
5083
5085
  // *********************************************************************************
5084
5086
 
5085
5087
  // DBG
5086
- console.log("11111 Socket:",JSON.stringify(Socket));
5087
- console.log("11111 WebSocket:",JSON.stringify(WebSocket));
5088
+ console.log("11111 WebsocketImplementation.Socket:",JSON.stringify(WebsocketImplementation.Socket));
5089
+ console.log("11111 WebsocketImplementation.WebSocket:",JSON.stringify(WebsocketImplementation.WebSocket));
5088
5090
 
5089
5091
 
5090
5092
  return WebsocketImplementation;
@@ -5104,17 +5106,17 @@ WebsocketImplementation={
5104
5106
  // NODE SERVER MODE ONLY :
5105
5107
  let serverSocket;
5106
5108
  if(!WebsocketImplementation.useSocketIOImplementation){
5107
- serverSocket=new WebSocket.Server({ "server":listenableServer });
5109
+ serverSocket=new WebsocketImplementation.WebSocket.Server({ "server":listenableServer });
5108
5110
  }else{
5109
5111
 
5110
5112
 
5111
5113
  // DBG
5112
- console.log(">>>>>>>Socket:",JSON.stringify(Socket));
5113
- console.log(">>>>>>>WebSocket:",JSON.stringify(WebSocket));
5114
+ console.log(">>>>>>>WebsocketImplementation.Socket:",JSON.stringify(WebsocketImplementation.Socket));
5115
+ console.log(">>>>>>>WebsocketImplementation.WebSocket:",JSON.stringify(WebsocketImplementation.WebSocket));
5114
5116
 
5115
5117
  // NOW : socket.io :
5116
5118
  // Loading socket.io
5117
- serverSocket=Socket.listen(listenableServer);
5119
+ serverSocket=WebsocketImplementation.Socket.listen(listenableServer);
5118
5120
 
5119
5121
  // Setting up the disctonnect event :
5120
5122
  serverSocket.on("endConnection",()=>{
@@ -5202,7 +5204,7 @@ WebsocketImplementation={
5202
5204
 
5203
5205
 
5204
5206
  // TODO : FIXME : Use one single interface !
5205
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
5207
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
5206
5208
  else if(clientSocket.connected) return;
5207
5209
 
5208
5210
 
@@ -5226,7 +5228,7 @@ WebsocketImplementation={
5226
5228
 
5227
5229
  // TODO : FIXME : Use one single interface !
5228
5230
  let clientSocket=clientSocketParam;
5229
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
5231
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
5230
5232
  else if(clientSocket.connected) return;
5231
5233
 
5232
5234
 
@@ -5403,7 +5405,7 @@ WebsocketImplementation={
5403
5405
 
5404
5406
 
5405
5407
  // NEW : ws :
5406
- if(typeof(WebSocket)==="undefined"){
5408
+ if(typeof(WebsocketImplementation.WebSocket)==="undefined"){
5407
5409
  // TRACE
5408
5410
  lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
5409
5411
  return null;
@@ -5412,17 +5414,17 @@ WebsocketImplementation={
5412
5414
  // NODE CLIENT MODE ONLY :
5413
5415
  let clientSocket;
5414
5416
  if(!WebsocketImplementation.useSocketIOImplementation){
5415
- clientSocket=new WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
5417
+ clientSocket=new WebsocketImplementation.WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
5416
5418
  }else{
5417
5419
  // NOW : socket.io :
5418
5420
  //client on server-side:
5419
5421
 
5420
- if(WebsocketImplementation.isNodeContext && typeof(Socket)!=="undefined"){
5422
+ if(WebsocketImplementation.isNodeContext && typeof(WebsocketImplementation.Socket)!=="undefined"){
5421
5423
  // // Node client :
5422
5424
  // connectToServer=function (serverURL, port, isSecure, timeout=10000){
5423
- // return Socket.connect(serverURL + ":" + port,{timeout: timeout});
5425
+ // return WebsocketImplementation.Socket.connect(serverURL + ":" + port,{timeout: timeout});
5424
5426
  // }
5425
- clientSocket=Socket.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
5427
+ clientSocket=WebsocketImplementation.Socket.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
5426
5428
  }
5427
5429
  }
5428
5430
 
@@ -5482,7 +5484,7 @@ WebsocketImplementation={
5482
5484
  // console.log("(NODE CLIENT) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
5483
5485
 
5484
5486
  // TODO : FIXME : Use one single interface !
5485
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
5487
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
5486
5488
  else if(clientSocket.connected) return;
5487
5489
 
5488
5490
 
@@ -5559,7 +5561,7 @@ WebsocketImplementation={
5559
5561
  /*private*/connectToServerFromBrowser:(serverURL, port, isSecure, timeout)=>{
5560
5562
 
5561
5563
  // NEW : ws :
5562
- if(typeof(WebSocket)==="undefined"){
5564
+ if(typeof(WebsocketImplementation.WebSocket)==="undefined"){
5563
5565
  // TRACE
5564
5566
  lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
5565
5567
  return null;
@@ -5569,7 +5571,7 @@ WebsocketImplementation={
5569
5571
  // BROWSER CLIENT MODE ONLY :
5570
5572
  let clientSocket;
5571
5573
  if(!WebsocketImplementation.useSocketIOImplementation){
5572
- clientSocket=new WebSocket(serverURL+":"+port,["ws","wss"]);
5574
+ clientSocket=new WebsocketImplementation.WebSocket(serverURL+":"+port,["ws","wss"]);
5573
5575
  }else if(typeof(io)!=="undefined"){
5574
5576
  // NOW : socket.io :
5575
5577
  // // Browser client :
@@ -5635,7 +5637,7 @@ WebsocketImplementation={
5635
5637
  // console.log("(BROWSER) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
5636
5638
 
5637
5639
  // TODO : FIXME : Use one single interface !
5638
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
5640
+ if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebsocketImplementation.WebSocket.OPEN) return;
5639
5641
  else if(clientSocket.connected) return;
5640
5642
 
5641
5643
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.114",
3
+ "version": "0.0.115",
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)",