aotrautils-srv 0.0.131 → 0.0.134
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-
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1.0.0.000 (16/07/2022-17:13:09)»*/
|
|
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-
|
|
4831
|
+
/*utils SERVER library associated with aotra version : «1.0.0.000 (16/07/2022-17:13:09)»*/
|
|
4832
4832
|
/*-----------------------------------------------------------------------------*/
|
|
4833
4833
|
|
|
4834
4834
|
|
|
@@ -5061,7 +5061,7 @@ WebsocketImplementation={
|
|
|
5061
5061
|
//
|
|
5062
5062
|
// NODE SERVER/CLIENT
|
|
5063
5063
|
//
|
|
5064
|
-
getStatic:(isNodeContext=true, useSocketIOImplementation
|
|
5064
|
+
getStatic:(isNodeContext=true, useSocketIOImplementation=/*DEBUG*/false)=>{
|
|
5065
5065
|
|
|
5066
5066
|
WebsocketImplementation.isNodeContext=isNodeContext;
|
|
5067
5067
|
WebsocketImplementation.useSocketIOImplementation=useSocketIOImplementation;
|
|
@@ -5070,16 +5070,18 @@ WebsocketImplementation={
|
|
|
5070
5070
|
// TRACE
|
|
5071
5071
|
lognow("INFO : (SERVER/CLIENT) Using socket.io websocket implementation.");
|
|
5072
5072
|
|
|
5073
|
-
if(isNodeContext
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5073
|
+
if(isNodeContext){
|
|
5074
|
+
if(typeof(Socket)==="undefined"){
|
|
5075
|
+
// TRACE
|
|
5076
|
+
console.log("«socket.io» SERVER library not called yet, calling it now.");
|
|
5077
|
+
Socket=require("socket.io");
|
|
5078
|
+
return WebsocketImplementation;
|
|
5079
|
+
}
|
|
5080
|
+
if(typeof(Socket)==="undefined"){
|
|
5081
|
+
// TRACE
|
|
5082
|
+
console.log("ERROR : «socket.io» CONSOLE/BROWSER CLIENT/SERVER library not found. Cannot launch nodejs server. Aborting.");
|
|
5083
|
+
return WebsocketImplementation;
|
|
5084
|
+
}
|
|
5083
5085
|
}
|
|
5084
5086
|
|
|
5085
5087
|
}else{
|
|
@@ -5087,17 +5089,19 @@ WebsocketImplementation={
|
|
|
5087
5089
|
lognow("INFO : (SERVER/CLIENT) Using native WebSocket implementation.");
|
|
5088
5090
|
|
|
5089
5091
|
// https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications
|
|
5090
|
-
if(isNodeContext
|
|
5091
|
-
WebSocket
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5092
|
+
if(isNodeContext){
|
|
5093
|
+
if(typeof(WebSocket)==="undefined"){
|
|
5094
|
+
WebSocket=require("ws");
|
|
5095
|
+
// TRACE
|
|
5096
|
+
console.log("«ws» SERVER library not called yet, calling it now.");
|
|
5097
|
+
return WebsocketImplementation;
|
|
5098
|
+
}
|
|
5099
|
+
if(typeof(WebSocket)==="undefined"){
|
|
5100
|
+
// TRACE
|
|
5101
|
+
console.log("ERROR : «ws» CONSOLE/BROWSER CLIENT/SERVER library not found. Cannot launch nodejs server. Aborting.");
|
|
5102
|
+
return WebsocketImplementation;
|
|
5103
|
+
}
|
|
5095
5104
|
}
|
|
5096
|
-
if(typeof(WebSocket)==="undefined"){
|
|
5097
|
-
// TRACE
|
|
5098
|
-
console.log("ERROR : «ws» CONSOLE/BROWSER CLIENT/SERVER library not found. Cannot launch nodejs server. Aborting.");
|
|
5099
|
-
return WebsocketImplementation;
|
|
5100
|
-
}
|
|
5101
5105
|
|
|
5102
5106
|
}
|
|
5103
5107
|
|
|
@@ -5826,7 +5830,7 @@ launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, /
|
|
|
5826
5830
|
}
|
|
5827
5831
|
|
|
5828
5832
|
|
|
5829
|
-
const server=WebsocketImplementation.getStatic(true
|
|
5833
|
+
const server=WebsocketImplementation.getStatic(true).getServer(listenableServer, port);
|
|
5830
5834
|
|
|
5831
5835
|
// When a client connects, we execute the callback :
|
|
5832
5836
|
// CAUTION : MUST BE CALLED ONLY ONCE !
|
|
@@ -5836,6 +5840,10 @@ launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, /
|
|
|
5836
5840
|
|
|
5837
5841
|
|
|
5838
5842
|
server.onFinalize((serverParam)=>{
|
|
5843
|
+
|
|
5844
|
+
// DBG
|
|
5845
|
+
lognow("onFinalize!!!!!");
|
|
5846
|
+
|
|
5839
5847
|
if(doOnFinalizeServer) doOnFinalizeServer(serverParam);
|
|
5840
5848
|
});
|
|
5841
5849
|
|
|
@@ -5958,6 +5966,7 @@ initNodeServer=function(doOnClientConnection=null, doOnFinalizeServer=null, /*OP
|
|
|
5958
5966
|
//aotraNodeServer.serverManager.microClientsSockets=[];
|
|
5959
5967
|
// UNUSEFUL :
|
|
5960
5968
|
//aotraNodeServer.serverManager.mainClientsSockets=[];
|
|
5969
|
+
|
|
5961
5970
|
aotraNodeServer.serverManager.start=function(){
|
|
5962
5971
|
|
|
5963
5972
|
// Eventual encryption options :
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.134",
|
|
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)",
|