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