aotrautils-srv 0.0.119 → 0.0.122
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:33:02)»*/
|
|
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:33:02)»*/
|
|
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,23 +5110,27 @@ 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=new Socket(listenableServer);
|
|
5124
|
+
// OLD SYNTAX : serverSocket=Socket.listen(listenableServer);
|
|
5124
5125
|
|
|
5125
5126
|
// Setting up the disctonnect event :
|
|
5126
5127
|
serverSocket.on("endConnection",()=>{
|
|
5127
5128
|
serverSocket.disconnect();
|
|
5128
5129
|
});
|
|
5129
5130
|
|
|
5131
|
+
// ////
|
|
5132
|
+
// serverSocket.listen();
|
|
5133
|
+
|
|
5130
5134
|
}
|
|
5131
5135
|
|
|
5132
5136
|
// NODE SERVER INSTANCE :
|
|
@@ -5208,7 +5212,7 @@ WebsocketImplementation={
|
|
|
5208
5212
|
|
|
5209
5213
|
|
|
5210
5214
|
// TODO : FIXME : Use one single interface !
|
|
5211
|
-
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==
|
|
5215
|
+
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
|
|
5212
5216
|
else if(clientSocket.connected) return;
|
|
5213
5217
|
|
|
5214
5218
|
|
|
@@ -5232,7 +5236,7 @@ WebsocketImplementation={
|
|
|
5232
5236
|
|
|
5233
5237
|
// TODO : FIXME : Use one single interface !
|
|
5234
5238
|
let clientSocket=clientSocketParam;
|
|
5235
|
-
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==
|
|
5239
|
+
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
|
|
5236
5240
|
else if(clientSocket.connected) return;
|
|
5237
5241
|
|
|
5238
5242
|
|
|
@@ -5409,7 +5413,7 @@ WebsocketImplementation={
|
|
|
5409
5413
|
|
|
5410
5414
|
|
|
5411
5415
|
// NEW : ws :
|
|
5412
|
-
if(typeof(
|
|
5416
|
+
if(typeof(WebSocket)==="undefined"){
|
|
5413
5417
|
// TRACE
|
|
5414
5418
|
lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
|
|
5415
5419
|
return null;
|
|
@@ -5418,17 +5422,17 @@ WebsocketImplementation={
|
|
|
5418
5422
|
// NODE CLIENT MODE ONLY :
|
|
5419
5423
|
let clientSocket;
|
|
5420
5424
|
if(!WebsocketImplementation.useSocketIOImplementation){
|
|
5421
|
-
clientSocket=new
|
|
5425
|
+
clientSocket=new WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
|
|
5422
5426
|
}else{
|
|
5423
5427
|
// NOW : socket.io :
|
|
5424
5428
|
//client on server-side:
|
|
5425
5429
|
|
|
5426
|
-
if(WebsocketImplementation.isNodeContext && typeof(
|
|
5430
|
+
if(WebsocketImplementation.isNodeContext && typeof(Socket)!=="undefined"){
|
|
5427
5431
|
// // Node client :
|
|
5428
5432
|
// connectToServer=function (serverURL, port, isSecure, timeout=10000){
|
|
5429
|
-
// return
|
|
5433
|
+
// return Socket.connect(serverURL + ":" + port,{timeout: timeout});
|
|
5430
5434
|
// }
|
|
5431
|
-
clientSocket=
|
|
5435
|
+
clientSocket=Socket.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
5432
5436
|
}
|
|
5433
5437
|
}
|
|
5434
5438
|
|
|
@@ -5488,7 +5492,7 @@ WebsocketImplementation={
|
|
|
5488
5492
|
// console.log("(NODE CLIENT) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
|
|
5489
5493
|
|
|
5490
5494
|
// TODO : FIXME : Use one single interface !
|
|
5491
|
-
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==
|
|
5495
|
+
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
|
|
5492
5496
|
else if(clientSocket.connected) return;
|
|
5493
5497
|
|
|
5494
5498
|
|
|
@@ -5565,7 +5569,7 @@ WebsocketImplementation={
|
|
|
5565
5569
|
/*private*/connectToServerFromBrowser:(serverURL, port, isSecure, timeout)=>{
|
|
5566
5570
|
|
|
5567
5571
|
// NEW : ws :
|
|
5568
|
-
if(typeof(
|
|
5572
|
+
if(typeof(WebSocket)==="undefined"){
|
|
5569
5573
|
// TRACE
|
|
5570
5574
|
lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
|
|
5571
5575
|
return null;
|
|
@@ -5575,7 +5579,7 @@ WebsocketImplementation={
|
|
|
5575
5579
|
// BROWSER CLIENT MODE ONLY :
|
|
5576
5580
|
let clientSocket;
|
|
5577
5581
|
if(!WebsocketImplementation.useSocketIOImplementation){
|
|
5578
|
-
clientSocket=new
|
|
5582
|
+
clientSocket=new WebSocket(serverURL+":"+port,["ws","wss"]);
|
|
5579
5583
|
}else if(typeof(io)!=="undefined"){
|
|
5580
5584
|
// NOW : socket.io :
|
|
5581
5585
|
// // Browser client :
|
|
@@ -5641,7 +5645,7 @@ WebsocketImplementation={
|
|
|
5641
5645
|
// console.log("(BROWSER) TRYING TO SEND : clientSocket.readyState:",clientSocket.readyState);
|
|
5642
5646
|
|
|
5643
5647
|
// TODO : FIXME : Use one single interface !
|
|
5644
|
-
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==
|
|
5648
|
+
if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState!==WebSocket.OPEN) return;
|
|
5645
5649
|
else if(clientSocket.connected) return;
|
|
5646
5650
|
|
|
5647
5651
|
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.122",
|
|
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)",
|