aotrautils-srv 0.0.118 → 0.0.121
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-15:
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1.0.0.000 (16/07/2022-15:19:19)»*/
|
|
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-15:
|
|
4831
|
+
/*utils SERVER library associated with aotra version : «1.0.0.000 (16/07/2022-15:19:19)»*/
|
|
4832
4832
|
/*-----------------------------------------------------------------------------*/
|
|
4833
4833
|
|
|
4834
4834
|
|
|
@@ -5053,8 +5053,8 @@ if(typeof(fs)==="undefined"){
|
|
|
5053
5053
|
// NODE ONLY SERVER / CLIENTS :
|
|
5054
5054
|
WebsocketImplementation={
|
|
5055
5055
|
|
|
5056
|
-
|
|
5057
|
-
|
|
5056
|
+
// Socket:Socket,
|
|
5057
|
+
// WebSocket:WebSocket,
|
|
5058
5058
|
|
|
5059
5059
|
isNodeContext:true,
|
|
5060
5060
|
useSocketIOImplementation:false,
|
|
@@ -5088,10 +5088,9 @@ WebsocketImplementation={
|
|
|
5088
5088
|
// *********************************************************************************
|
|
5089
5089
|
|
|
5090
5090
|
// DBG
|
|
5091
|
-
console.log("11111
|
|
5092
|
-
console.log("11111
|
|
5093
|
-
|
|
5094
|
-
console.log("11111 WebsocketImplementation.WebSocket:",JSON.stringify(WebsocketImplementation.WebSocket));
|
|
5091
|
+
console.log("11111 Socket:",Socket);
|
|
5092
|
+
console.log("11111 WebSocket:",WebSocket);
|
|
5093
|
+
|
|
5095
5094
|
|
|
5096
5095
|
|
|
5097
5096
|
return WebsocketImplementation;
|
|
@@ -5111,17 +5110,17 @@ WebsocketImplementation={
|
|
|
5111
5110
|
// NODE SERVER MODE ONLY :
|
|
5112
5111
|
let serverSocket;
|
|
5113
5112
|
if(!WebsocketImplementation.useSocketIOImplementation){
|
|
5114
|
-
serverSocket=new
|
|
5113
|
+
serverSocket=new WebSocket.Server({ "server":listenableServer });
|
|
5115
5114
|
}else{
|
|
5116
5115
|
|
|
5117
5116
|
|
|
5118
5117
|
// DBG
|
|
5119
|
-
console.log(">>>>>>>
|
|
5120
|
-
console.log(">>>>>>>
|
|
5118
|
+
console.log(">>>>>>>Socket:",Socket);
|
|
5119
|
+
console.log(">>>>>>>WebSocket:",WebSocket);
|
|
5121
5120
|
|
|
5122
5121
|
// NOW : socket.io :
|
|
5123
5122
|
// Loading socket.io
|
|
5124
|
-
serverSocket=
|
|
5123
|
+
serverSocket=Socket.listen(listenableServer);
|
|
5125
5124
|
|
|
5126
5125
|
// Setting up the disctonnect event :
|
|
5127
5126
|
serverSocket.on("endConnection",()=>{
|
|
@@ -5209,7 +5208,7 @@ WebsocketImplementation={
|
|
|
5209
5208
|
|
|
5210
5209
|
|
|
5211
5210
|
// TODO : FIXME : Use one single interface !
|
|
5212
|
-
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==
|
|
5211
|
+
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
|
|
5213
5212
|
else if(clientSocket.connected) return;
|
|
5214
5213
|
|
|
5215
5214
|
|
|
@@ -5233,7 +5232,7 @@ WebsocketImplementation={
|
|
|
5233
5232
|
|
|
5234
5233
|
// TODO : FIXME : Use one single interface !
|
|
5235
5234
|
let clientSocket=clientSocketParam;
|
|
5236
|
-
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==
|
|
5235
|
+
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
|
|
5237
5236
|
else if(clientSocket.connected) return;
|
|
5238
5237
|
|
|
5239
5238
|
|
|
@@ -5410,7 +5409,7 @@ WebsocketImplementation={
|
|
|
5410
5409
|
|
|
5411
5410
|
|
|
5412
5411
|
// NEW : ws :
|
|
5413
|
-
if(typeof(
|
|
5412
|
+
if(typeof(WebSocket)==="undefined"){
|
|
5414
5413
|
// TRACE
|
|
5415
5414
|
lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
|
|
5416
5415
|
return null;
|
|
@@ -5419,17 +5418,17 @@ WebsocketImplementation={
|
|
|
5419
5418
|
// NODE CLIENT MODE ONLY :
|
|
5420
5419
|
let clientSocket;
|
|
5421
5420
|
if(!WebsocketImplementation.useSocketIOImplementation){
|
|
5422
|
-
clientSocket=new
|
|
5421
|
+
clientSocket=new WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
|
|
5423
5422
|
}else{
|
|
5424
5423
|
// NOW : socket.io :
|
|
5425
5424
|
//client on server-side:
|
|
5426
5425
|
|
|
5427
|
-
if(WebsocketImplementation.isNodeContext && typeof(
|
|
5426
|
+
if(WebsocketImplementation.isNodeContext && typeof(Socket)!=="undefined"){
|
|
5428
5427
|
// // Node client :
|
|
5429
5428
|
// connectToServer=function (serverURL, port, isSecure, timeout=10000){
|
|
5430
|
-
// return
|
|
5429
|
+
// return Socket.connect(serverURL + ":" + port,{timeout: timeout});
|
|
5431
5430
|
// }
|
|
5432
|
-
clientSocket=
|
|
5431
|
+
clientSocket=Socket.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
5433
5432
|
}
|
|
5434
5433
|
}
|
|
5435
5434
|
|
|
@@ -5489,7 +5488,7 @@ WebsocketImplementation={
|
|
|
5489
5488
|
// console.log("(NODE CLIENT) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
|
|
5490
5489
|
|
|
5491
5490
|
// TODO : FIXME : Use one single interface !
|
|
5492
|
-
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==
|
|
5491
|
+
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
|
|
5493
5492
|
else if(clientSocket.connected) return;
|
|
5494
5493
|
|
|
5495
5494
|
|
|
@@ -5566,7 +5565,7 @@ WebsocketImplementation={
|
|
|
5566
5565
|
/*private*/connectToServerFromBrowser:(serverURL, port, isSecure, timeout)=>{
|
|
5567
5566
|
|
|
5568
5567
|
// NEW : ws :
|
|
5569
|
-
if(typeof(
|
|
5568
|
+
if(typeof(WebSocket)==="undefined"){
|
|
5570
5569
|
// TRACE
|
|
5571
5570
|
lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
|
|
5572
5571
|
return null;
|
|
@@ -5576,7 +5575,7 @@ WebsocketImplementation={
|
|
|
5576
5575
|
// BROWSER CLIENT MODE ONLY :
|
|
5577
5576
|
let clientSocket;
|
|
5578
5577
|
if(!WebsocketImplementation.useSocketIOImplementation){
|
|
5579
|
-
clientSocket=new
|
|
5578
|
+
clientSocket=new WebSocket(serverURL+":"+port,["ws","wss"]);
|
|
5580
5579
|
}else if(typeof(io)!=="undefined"){
|
|
5581
5580
|
// NOW : socket.io :
|
|
5582
5581
|
// // Browser client :
|
|
@@ -5642,7 +5641,7 @@ WebsocketImplementation={
|
|
|
5642
5641
|
// console.log("(BROWSER) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
|
|
5643
5642
|
|
|
5644
5643
|
// TODO : FIXME : Use one single interface !
|
|
5645
|
-
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==
|
|
5644
|
+
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
|
|
5646
5645
|
else if(clientSocket.connected) return;
|
|
5647
5646
|
|
|
5648
5647
|
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.121",
|
|
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)",
|