aotrautils-srv 0.0.119 → 0.0.120
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:18:00)»*/
|
|
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:18:00)»*/
|
|
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,8 +5088,8 @@ WebsocketImplementation={
|
|
|
5088
5088
|
// *********************************************************************************
|
|
5089
5089
|
|
|
5090
5090
|
// DBG
|
|
5091
|
-
console.log("11111
|
|
5092
|
-
console.log("11111
|
|
5091
|
+
console.log("11111 Socket:",Socket);
|
|
5092
|
+
console.log("11111 WebSocket:",WebSocket);
|
|
5093
5093
|
|
|
5094
5094
|
|
|
5095
5095
|
|
|
@@ -5110,17 +5110,17 @@ WebsocketImplementation={
|
|
|
5110
5110
|
// NODE SERVER MODE ONLY :
|
|
5111
5111
|
let serverSocket;
|
|
5112
5112
|
if(!WebsocketImplementation.useSocketIOImplementation){
|
|
5113
|
-
serverSocket=new
|
|
5113
|
+
serverSocket=new WebSocket.Server({ "server":listenableServer });
|
|
5114
5114
|
}else{
|
|
5115
5115
|
|
|
5116
5116
|
|
|
5117
5117
|
// DBG
|
|
5118
|
-
console.log(">>>>>>>
|
|
5119
|
-
console.log(">>>>>>>
|
|
5118
|
+
console.log(">>>>>>>Socket:",Socket);
|
|
5119
|
+
console.log(">>>>>>>WebSocket:",WebSocket);
|
|
5120
5120
|
|
|
5121
5121
|
// NOW : socket.io :
|
|
5122
5122
|
// Loading socket.io
|
|
5123
|
-
serverSocket=
|
|
5123
|
+
serverSocket=Socket.listen(listenableServer);
|
|
5124
5124
|
|
|
5125
5125
|
// Setting up the disctonnect event :
|
|
5126
5126
|
serverSocket.on("endConnection",()=>{
|
|
@@ -5208,7 +5208,7 @@ WebsocketImplementation={
|
|
|
5208
5208
|
|
|
5209
5209
|
|
|
5210
5210
|
// TODO : FIXME : Use one single interface !
|
|
5211
|
-
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==
|
|
5211
|
+
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
|
|
5212
5212
|
else if(clientSocket.connected) return;
|
|
5213
5213
|
|
|
5214
5214
|
|
|
@@ -5232,7 +5232,7 @@ WebsocketImplementation={
|
|
|
5232
5232
|
|
|
5233
5233
|
// TODO : FIXME : Use one single interface !
|
|
5234
5234
|
let clientSocket=clientSocketParam;
|
|
5235
|
-
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==
|
|
5235
|
+
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
|
|
5236
5236
|
else if(clientSocket.connected) return;
|
|
5237
5237
|
|
|
5238
5238
|
|
|
@@ -5409,7 +5409,7 @@ WebsocketImplementation={
|
|
|
5409
5409
|
|
|
5410
5410
|
|
|
5411
5411
|
// NEW : ws :
|
|
5412
|
-
if(typeof(
|
|
5412
|
+
if(typeof(WebSocket)==="undefined"){
|
|
5413
5413
|
// TRACE
|
|
5414
5414
|
lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
|
|
5415
5415
|
return null;
|
|
@@ -5418,17 +5418,17 @@ WebsocketImplementation={
|
|
|
5418
5418
|
// NODE CLIENT MODE ONLY :
|
|
5419
5419
|
let clientSocket;
|
|
5420
5420
|
if(!WebsocketImplementation.useSocketIOImplementation){
|
|
5421
|
-
clientSocket=new
|
|
5421
|
+
clientSocket=new WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
|
|
5422
5422
|
}else{
|
|
5423
5423
|
// NOW : socket.io :
|
|
5424
5424
|
//client on server-side:
|
|
5425
5425
|
|
|
5426
|
-
if(WebsocketImplementation.isNodeContext && typeof(
|
|
5426
|
+
if(WebsocketImplementation.isNodeContext && typeof(Socket)!=="undefined"){
|
|
5427
5427
|
// // Node client :
|
|
5428
5428
|
// connectToServer=function (serverURL, port, isSecure, timeout=10000){
|
|
5429
|
-
// return
|
|
5429
|
+
// return Socket.connect(serverURL + ":" + port,{timeout: timeout});
|
|
5430
5430
|
// }
|
|
5431
|
-
clientSocket=
|
|
5431
|
+
clientSocket=Socket.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
5432
5432
|
}
|
|
5433
5433
|
}
|
|
5434
5434
|
|
|
@@ -5488,7 +5488,7 @@ WebsocketImplementation={
|
|
|
5488
5488
|
// console.log("(NODE CLIENT) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
|
|
5489
5489
|
|
|
5490
5490
|
// TODO : FIXME : Use one single interface !
|
|
5491
|
-
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==
|
|
5491
|
+
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
|
|
5492
5492
|
else if(clientSocket.connected) return;
|
|
5493
5493
|
|
|
5494
5494
|
|
|
@@ -5565,7 +5565,7 @@ WebsocketImplementation={
|
|
|
5565
5565
|
/*private*/connectToServerFromBrowser:(serverURL, port, isSecure, timeout)=>{
|
|
5566
5566
|
|
|
5567
5567
|
// NEW : ws :
|
|
5568
|
-
if(typeof(
|
|
5568
|
+
if(typeof(WebSocket)==="undefined"){
|
|
5569
5569
|
// TRACE
|
|
5570
5570
|
lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
|
|
5571
5571
|
return null;
|
|
@@ -5575,7 +5575,7 @@ WebsocketImplementation={
|
|
|
5575
5575
|
// BROWSER CLIENT MODE ONLY :
|
|
5576
5576
|
let clientSocket;
|
|
5577
5577
|
if(!WebsocketImplementation.useSocketIOImplementation){
|
|
5578
|
-
clientSocket=new
|
|
5578
|
+
clientSocket=new WebSocket(serverURL+":"+port,["ws","wss"]);
|
|
5579
5579
|
}else if(typeof(io)!=="undefined"){
|
|
5580
5580
|
// NOW : socket.io :
|
|
5581
5581
|
// // Browser client :
|
|
@@ -5641,7 +5641,7 @@ WebsocketImplementation={
|
|
|
5641
5641
|
// console.log("(BROWSER) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
|
|
5642
5642
|
|
|
5643
5643
|
// TODO : FIXME : Use one single interface !
|
|
5644
|
-
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==
|
|
5644
|
+
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
|
|
5645
5645
|
else if(clientSocket.connected) return;
|
|
5646
5646
|
|
|
5647
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.120",
|
|
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)",
|