aotrautils 0.0.1910 → 0.0.1912
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.
- aotrautils/aotrautils.build.js +107 -107
- aotrautils/package-lock.json +2 -2
- aotrautils/package.json +1 -1
aotrautils/aotrautils.build.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (26/07/2026-03:
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (26/07/2026-03:28:56)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -5470,7 +5470,7 @@ window.AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
5470
5470
|
|
|
5471
5471
|
|
|
5472
5472
|
|
|
5473
|
-
/*utils CLIENT library associated with aotra version : «1_29072022-2359 (26/07/2026-03:
|
|
5473
|
+
/*utils CLIENT library associated with aotra version : «1_29072022-2359 (26/07/2026-03:28:56)»*/
|
|
5474
5474
|
/*-----------------------------------------------------------------------------*/
|
|
5475
5475
|
/* ## Utility global methods in a browser (htmljs) client environment.
|
|
5476
5476
|
*
|
|
@@ -12544,7 +12544,7 @@ window.createOritaMicroClient=function(url, port, isNode=false, staticMicroClien
|
|
|
12544
12544
|
// TODO : FIXME : Utiliser window.initClient(...) au lieu de directement getStatic(...) avec le paramètre isNode transmis dans l'appel)
|
|
12545
12545
|
//oritaClient=window.initClient(isNode,false,doOnServerConnection=null, url, port);
|
|
12546
12546
|
oritaClient.client={};
|
|
12547
|
-
oritaClient.client.socketToServerClientInstance=WebsocketImplementation.getStatic(isNode).connectToServer(url, port);
|
|
12547
|
+
oritaClient.client.socketToServerClientInstance=window.WebsocketImplementation.getStatic(isNode).connectToServer(url, port);
|
|
12548
12548
|
oritaClient.client.socketToServerClientInstance.onConnectionToServer(() => {
|
|
12549
12549
|
|
|
12550
12550
|
|
|
@@ -13291,7 +13291,7 @@ window.createOritaMicroClient=function(url, port, isNode=false, staticMicroClien
|
|
|
13291
13291
|
|
|
13292
13292
|
|
|
13293
13293
|
|
|
13294
|
-
/*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (26/07/2026-03:
|
|
13294
|
+
/*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (26/07/2026-03:28:56)»*/
|
|
13295
13295
|
/*-----------------------------------------------------------------------------*/
|
|
13296
13296
|
|
|
13297
13297
|
|
|
@@ -14376,10 +14376,10 @@ function rayVsUnitSphereClosestPoint(p, r) {
|
|
|
14376
14376
|
// MUST REMAIN AT THE END OF THIS LIBRARY FILE !
|
|
14377
14377
|
|
|
14378
14378
|
AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
|
|
14379
|
-
/*utils 3D library associated with aotra version : «1_29072022-2359 (26/07/2026-03:
|
|
14379
|
+
/*utils 3D library associated with aotra version : «1_29072022-2359 (26/07/2026-03:28:56)»*/
|
|
14380
14380
|
/*-----------------------------------------------------------------------------*/
|
|
14381
14381
|
|
|
14382
|
-
/*utils AI library associated with aotra version : «1_29072022-2359 (26/07/2026-03:
|
|
14382
|
+
/*utils AI library associated with aotra version : «1_29072022-2359 (26/07/2026-03:28:56)»*/
|
|
14383
14383
|
/*-----------------------------------------------------------------------------*/
|
|
14384
14384
|
|
|
14385
14385
|
|
|
@@ -14639,7 +14639,7 @@ window.getLLMAPIClient=(modelName, apiURL, agentRole, defaultPrompt, llmProvider
|
|
|
14639
14639
|
|
|
14640
14640
|
|
|
14641
14641
|
|
|
14642
|
-
/*utils CONSOLE library associated with aotra version : «1_29072022-2359 (26/07/2026-03:
|
|
14642
|
+
/*utils CONSOLE library associated with aotra version : «1_29072022-2359 (26/07/2026-03:28:56)»*/
|
|
14643
14643
|
/*-----------------------------------------------------------------------------*/
|
|
14644
14644
|
|
|
14645
14645
|
|
|
@@ -16758,10 +16758,10 @@ window.fileExists=(filePath)=>{
|
|
|
16758
16758
|
//- WEBSOCKETS AND NODEJS :
|
|
16759
16759
|
|
|
16760
16760
|
function isConnected(clientSocket){
|
|
16761
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
16762
|
-
if(!WebsocketImplementation.implementationToUse)
|
|
16761
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
16762
|
+
if(!window.WebsocketImplementation.implementationToUse)
|
|
16763
16763
|
return (clientSocket.readyState===WebSocket.OPEN)
|
|
16764
|
-
return WebsocketImplementation.implementationToUse.isConnected(clientSocket);
|
|
16764
|
+
return window.WebsocketImplementation.implementationToUse.isConnected(clientSocket);
|
|
16765
16765
|
// return (clientSocket.connected);
|
|
16766
16766
|
}
|
|
16767
16767
|
|
|
@@ -16891,7 +16891,7 @@ window.getConsoleCLI=(doOnCommands={"makeSandiwch":()=>{}}, promptText="Enter co
|
|
|
16891
16891
|
|
|
16892
16892
|
|
|
16893
16893
|
// NODE ONLY SERVER / CLIENTS :
|
|
16894
|
-
WebsocketImplementation={
|
|
16894
|
+
window.WebsocketImplementation={
|
|
16895
16895
|
|
|
16896
16896
|
|
|
16897
16897
|
isNodeContext:true,
|
|
@@ -16912,11 +16912,11 @@ WebsocketImplementation={
|
|
|
16912
16912
|
// , useSocketIOImplementation=/*DEBUG*/false
|
|
16913
16913
|
)=>{
|
|
16914
16914
|
|
|
16915
|
-
WebsocketImplementation.isNodeContext=isNodeContext;
|
|
16916
|
-
// WebsocketImplementation.useSocketIOImplementation=useSocketIOImplementation;
|
|
16915
|
+
window.WebsocketImplementation.isNodeContext=isNodeContext;
|
|
16916
|
+
// window.WebsocketImplementation.useSocketIOImplementation=useSocketIOImplementation;
|
|
16917
16917
|
|
|
16918
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
16919
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
16918
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
16919
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
16920
16920
|
|
|
16921
16921
|
// TRACE
|
|
16922
16922
|
lognow("INFO : (SERVER/CLIENT) Using native WebSocket implementation.");
|
|
@@ -16937,7 +16937,7 @@ WebsocketImplementation={
|
|
|
16937
16937
|
}
|
|
16938
16938
|
|
|
16939
16939
|
}else{
|
|
16940
|
-
window.WebSocket=WebsocketImplementation.implementationToUse.getSocketClass();
|
|
16940
|
+
window.WebSocket=window.WebsocketImplementation.implementationToUse.getSocketClass();
|
|
16941
16941
|
}
|
|
16942
16942
|
// // TRACE
|
|
16943
16943
|
// lognow("INFO : (SERVER/CLIENT) Using socket.io websocket implementation.");
|
|
@@ -16974,22 +16974,22 @@ WebsocketImplementation={
|
|
|
16974
16974
|
|
|
16975
16975
|
// *********************************************************************************
|
|
16976
16976
|
|
|
16977
|
-
return WebsocketImplementation;
|
|
16977
|
+
return window.WebsocketImplementation;
|
|
16978
16978
|
},
|
|
16979
16979
|
|
|
16980
16980
|
|
|
16981
16981
|
/*public*//*static*/getMessageDataBothImplementations:(eventOrMessageParam)=>{
|
|
16982
16982
|
|
|
16983
|
-
// const eventOrMessage=(!WebsocketImplementation.useSocketIOImplementation?eventOrMessageParam.data:eventOrMessageParam);
|
|
16983
|
+
// const eventOrMessage=(!window.WebsocketImplementation.useSocketIOImplementation?eventOrMessageParam.data:eventOrMessageParam);
|
|
16984
16984
|
const eventOrMessage=
|
|
16985
|
-
(!WebsocketImplementation.implementationToUse)?
|
|
16985
|
+
(!window.WebsocketImplementation.implementationToUse)?
|
|
16986
16986
|
eventOrMessageParam.data
|
|
16987
|
-
:WebsocketImplementation.implementationToUse.getData(eventOrMessageParam);
|
|
16987
|
+
:window.WebsocketImplementation.implementationToUse.getData(eventOrMessageParam);
|
|
16988
16988
|
|
|
16989
16989
|
let dataResult=eventOrMessage;
|
|
16990
16990
|
|
|
16991
16991
|
try{
|
|
16992
|
-
dataResult=(WebsocketImplementation.useFlatStrings || isString(eventOrMessage)?parseJSON(eventOrMessage):eventOrMessage);
|
|
16992
|
+
dataResult=(window.WebsocketImplementation.useFlatStrings || isString(eventOrMessage)?parseJSON(eventOrMessage):eventOrMessage);
|
|
16993
16993
|
}catch(error1){
|
|
16994
16994
|
// TRACE
|
|
16995
16995
|
lognow(`ERROR : Failed to parse JSON for string «${dataResult}»`,error1);
|
|
@@ -17002,15 +17002,15 @@ WebsocketImplementation={
|
|
|
17002
17002
|
|
|
17003
17003
|
getServer:(listenableServer)=>{
|
|
17004
17004
|
|
|
17005
|
-
if(!WebsocketImplementation.isNodeContext){
|
|
17005
|
+
if(!window.WebsocketImplementation.isNodeContext){
|
|
17006
17006
|
// TRACE
|
|
17007
17007
|
throw new Error("ERROR : SERVER : Server launch is not supported in a non-nodejs context for any implementation.");
|
|
17008
17008
|
}
|
|
17009
17009
|
|
|
17010
17010
|
// NODE SERVER MODE ONLY :
|
|
17011
17011
|
let serverSocket;
|
|
17012
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
17013
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
17012
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
17013
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
17014
17014
|
if(typeof(WebSocketServer)==="undefined")
|
|
17015
17015
|
window.WebSocketServer=require("ws");
|
|
17016
17016
|
if(typeof(WebSocketServer)==="undefined")
|
|
@@ -17028,7 +17028,7 @@ WebsocketImplementation={
|
|
|
17028
17028
|
});
|
|
17029
17029
|
|
|
17030
17030
|
}else{
|
|
17031
|
-
serverSocket=WebsocketImplementation.implementationToUse.getServerSocket(listenableServer);
|
|
17031
|
+
serverSocket=window.WebsocketImplementation.implementationToUse.getServerSocket(listenableServer);
|
|
17032
17032
|
|
|
17033
17033
|
//
|
|
17034
17034
|
// // Loading socket.io
|
|
@@ -17063,11 +17063,11 @@ WebsocketImplementation={
|
|
|
17063
17063
|
// To make the server aware of the clients connections states :
|
|
17064
17064
|
nodeServerInstance.serverSocket.on("close", function close() {
|
|
17065
17065
|
|
|
17066
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
17067
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
17066
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
17067
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
17068
17068
|
serverClients=nodeServerInstance.serverSocket.clients;
|
|
17069
17069
|
}else{
|
|
17070
|
-
serverClients=WebsocketImplementation.implementationToUse.getClientSockets();
|
|
17070
|
+
serverClients=window.WebsocketImplementation.implementationToUse.getClientSockets();
|
|
17071
17071
|
// serverClients=nodeServerInstance.serverSocket.sockets.sockets;
|
|
17072
17072
|
}
|
|
17073
17073
|
|
|
@@ -17084,12 +17084,12 @@ WebsocketImplementation={
|
|
|
17084
17084
|
connectToServer:(serverURL, port, isSecure=false, timeout)=>{
|
|
17085
17085
|
|
|
17086
17086
|
// TRACE
|
|
17087
|
-
lognow("INFO : Using socket library flavor : "+(WebsocketImplementation.isNodeContext?"node (client/server-side)":"browser (client-side only)"));
|
|
17087
|
+
lognow("INFO : Using socket library flavor : "+(window.WebsocketImplementation.isNodeContext?"node (client/server-side)":"browser (client-side only)"));
|
|
17088
17088
|
|
|
17089
|
-
if(WebsocketImplementation.isNodeContext)
|
|
17090
|
-
return WebsocketImplementation.connectToServerFromNode(serverURL, port, isSecure, timeout);
|
|
17089
|
+
if(window.WebsocketImplementation.isNodeContext)
|
|
17090
|
+
return window.WebsocketImplementation.connectToServerFromNode(serverURL, port, isSecure, timeout);
|
|
17091
17091
|
else
|
|
17092
|
-
return WebsocketImplementation.connectToServerFromBrowser(serverURL, port, isSecure, timeout);
|
|
17092
|
+
return window.WebsocketImplementation.connectToServerFromBrowser(serverURL, port, isSecure, timeout);
|
|
17093
17093
|
},
|
|
17094
17094
|
|
|
17095
17095
|
|
|
@@ -17100,8 +17100,8 @@ WebsocketImplementation={
|
|
|
17100
17100
|
|
|
17101
17101
|
// NODE CLIENT MODE ONLY :
|
|
17102
17102
|
let clientSocket;
|
|
17103
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
17104
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
17103
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
17104
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
17105
17105
|
|
|
17106
17106
|
// NEW : ws :
|
|
17107
17107
|
if(typeof(WebSocket)==="undefined"){
|
|
@@ -17130,11 +17130,11 @@ WebsocketImplementation={
|
|
|
17130
17130
|
});
|
|
17131
17131
|
|
|
17132
17132
|
}else{
|
|
17133
|
-
clientSocket=WebsocketImplementation.implementationToUse.getClientSocket(true);
|
|
17133
|
+
clientSocket=window.WebsocketImplementation.implementationToUse.getClientSocket(true);
|
|
17134
17134
|
|
|
17135
17135
|
// // NOW : socket.io :
|
|
17136
17136
|
// //client on server-side:
|
|
17137
|
-
// if(WebsocketImplementation.isNodeContext && typeof(io)!=="undefined"){
|
|
17137
|
+
// if(window.WebsocketImplementation.isNodeContext && typeof(io)!=="undefined"){
|
|
17138
17138
|
//// OLD SYNTAX: clientSocket=Socket.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
17139
17139
|
//// NO : clientSocket=new Socket.Client(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
17140
17140
|
// clientSocket=io(serverURL + ":" + port,{timeout: timeout, secure: isSecure, autoConnect:true});
|
|
@@ -17170,8 +17170,8 @@ WebsocketImplementation={
|
|
|
17170
17170
|
// BROWSER CLIENT MODE ONLY :
|
|
17171
17171
|
let clientSocket;
|
|
17172
17172
|
|
|
17173
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
17174
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
17173
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
17174
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
17175
17175
|
|
|
17176
17176
|
// CAUTION : PARAMETER rejectUnauthorized:false WILL DO NOTHING,
|
|
17177
17177
|
// BECAUSE THIS IS COMPLETLY HANDLED BY THE BROWSER SECURITY POLICY !
|
|
@@ -17186,7 +17186,7 @@ WebsocketImplementation={
|
|
|
17186
17186
|
});
|
|
17187
17187
|
}else{
|
|
17188
17188
|
// }else if(typeof(io)!=="undefined"){
|
|
17189
|
-
WebsocketImplementation.implementationToUse.getClientSocket();
|
|
17189
|
+
window.WebsocketImplementation.implementationToUse.getClientSocket();
|
|
17190
17190
|
// // OLD SYNTAX :clientSocket=io.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
17191
17191
|
// // ALTERNATIVE :
|
|
17192
17192
|
// clientSocket=io(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
@@ -17317,7 +17317,7 @@ window.launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=
|
|
|
17317
17317
|
}
|
|
17318
17318
|
|
|
17319
17319
|
|
|
17320
|
-
const server=WebsocketImplementation.getStatic(true).getServer(listenableServer);
|
|
17320
|
+
const server=window.WebsocketImplementation.getStatic(true).getServer(listenableServer);
|
|
17321
17321
|
|
|
17322
17322
|
// When a client connects, we execute the callback :
|
|
17323
17323
|
// CAUTION : MUST BE CALLED ONLY ONCE !
|
|
@@ -17998,41 +17998,41 @@ if(typeof(window)==="undefined") window=global;
|
|
|
17998
17998
|
// TODO : FIXME : DEVELOP...
|
|
17999
17999
|
// THIS IS HOW A implementationToUse FOR WEBSOCKET TECHNOLOGY MUST BE :
|
|
18000
18000
|
//
|
|
18001
|
-
//return WebsocketImplementation.implementationToUse.isConnected(clientSocket);
|
|
18001
|
+
//return window.WebsocketImplementation.implementationToUse.isConnected(clientSocket);
|
|
18002
18002
|
//
|
|
18003
|
-
//return WebsocketImplementation.implementationToUse.getSocketClass();
|
|
18003
|
+
//return window.WebsocketImplementation.implementationToUse.getSocketClass();
|
|
18004
18004
|
//
|
|
18005
|
-
//return WebsocketImplementation.implementationToUse.getData(eventOrMessageParam)
|
|
18006
|
-
// serverSocket=WebsocketImplementation.implementationToUse.getServerSocket(listenableServer);
|
|
18005
|
+
//return window.WebsocketImplementation.implementationToUse.getData(eventOrMessageParam)
|
|
18006
|
+
// serverSocket=window.WebsocketImplementation.implementationToUse.getServerSocket(listenableServer);
|
|
18007
18007
|
//
|
|
18008
|
-
//serverClients=WebsocketImplementation.implementationToUse.getClientSockets();
|
|
18008
|
+
//serverClients=window.WebsocketImplementation.implementationToUse.getClientSockets();
|
|
18009
18009
|
//
|
|
18010
|
-
//clientSocket=WebsocketImplementation.implementationToUse.getClientSocket(isNodeContext=true);
|
|
18010
|
+
//clientSocket=window.WebsocketImplementation.implementationToUse.getClientSocket(isNodeContext=true);
|
|
18011
18011
|
//
|
|
18012
|
-
//WebsocketImplementation.implementationToUse.send(dataWrapped);
|
|
18013
|
-
//WebsocketImplementation.implementationToUse.serverSend(clientSocket, dataWrapped);
|
|
18012
|
+
//window.WebsocketImplementation.implementationToUse.send(dataWrapped);
|
|
18013
|
+
//window.WebsocketImplementation.implementationToUse.serverSend(clientSocket, dataWrapped);
|
|
18014
18014
|
//
|
|
18015
|
-
//WebsocketImplementation.implementationToUse.receive((eventOrMessage)=>{ });
|
|
18015
|
+
//window.WebsocketImplementation.implementationToUse.receive((eventOrMessage)=>{ });
|
|
18016
18016
|
//
|
|
18017
18017
|
//
|
|
18018
|
-
//WebsocketImplementation.implementationToUse.initClientSocket(clientSocket);
|
|
18019
|
-
//WebsocketImplementation.implementationToUse.initOnClose(()=>{
|
|
18018
|
+
//window.WebsocketImplementation.implementationToUse.initClientSocket(clientSocket);
|
|
18019
|
+
//window.WebsocketImplementation.implementationToUse.initOnClose(()=>{
|
|
18020
18020
|
// foreach(self.onServerLostListeners,l=>{l.execute(self.clientSocket);});
|
|
18021
18021
|
//});
|
|
18022
18022
|
//
|
|
18023
|
-
//WebsocketImplementation.implementationToUse.initOnReceiveBrowserContext(channelNameParam, (eventOrMessage)=>{ });
|
|
18023
|
+
//window.WebsocketImplementation.implementationToUse.initOnReceiveBrowserContext(channelNameParam, (eventOrMessage)=>{ });
|
|
18024
18024
|
//
|
|
18025
|
-
//WebsocketImplementation.implementationToUse.initOnReceiveNodeContext(channelNameParam, serverReceptionEntryPoint);
|
|
18025
|
+
//window.WebsocketImplementation.implementationToUse.initOnReceiveNodeContext(channelNameParam, serverReceptionEntryPoint);
|
|
18026
18026
|
//
|
|
18027
|
-
//WebsocketImplementation.implementationToUse.getServerClients();
|
|
18027
|
+
//window.WebsocketImplementation.implementationToUse.getServerClients();
|
|
18028
18028
|
//
|
|
18029
|
-
//if(WebsocketImplementation.implementationToUse.isReady(clientSocket)) return;
|
|
18030
|
-
// WebsocketImplementation.implementationToUse.initOnMessageReceived(doOnMessage);
|
|
18031
|
-
// WebsocketImplementation.implementationToUse.terminate();
|
|
18029
|
+
//if(window.WebsocketImplementation.implementationToUse.isReady(clientSocket)) return;
|
|
18030
|
+
// window.WebsocketImplementation.implementationToUse.initOnMessageReceived(doOnMessage);
|
|
18031
|
+
// window.WebsocketImplementation.implementationToUse.terminate();
|
|
18032
18032
|
//
|
|
18033
|
-
//WebsocketImplementation.implementationToUse.ping();
|
|
18033
|
+
//window.WebsocketImplementation.implementationToUse.ping();
|
|
18034
18034
|
//
|
|
18035
|
-
//WebsocketImplementation.implementationToUse.doOnPong(()=>{
|
|
18035
|
+
//window.WebsocketImplementation.implementationToUse.doOnPong(()=>{
|
|
18036
18036
|
// clientSocket.isConnectionAlive=true;
|
|
18037
18037
|
//});
|
|
18038
18038
|
|
|
@@ -18059,7 +18059,7 @@ window.initClient=function(isNodeContext=true
|
|
|
18059
18059
|
// DBG
|
|
18060
18060
|
lognow("INFO : Setting up client :... (url:«"+url+"» ; port:«"+port+"»)");
|
|
18061
18061
|
|
|
18062
|
-
let socketToServerClientInstance=WebsocketImplementation.getStatic(isNodeContext
|
|
18062
|
+
let socketToServerClientInstance=window.WebsocketImplementation.getStatic(isNodeContext
|
|
18063
18063
|
// , useSocketIOImplementation
|
|
18064
18064
|
).connectToServer(url, port, isSecure, timeout);
|
|
18065
18065
|
if(!socketToServerClientInstance){
|
|
@@ -18157,7 +18157,7 @@ class ClientReceptionEntryPoint{
|
|
|
18157
18157
|
return;
|
|
18158
18158
|
}
|
|
18159
18159
|
|
|
18160
|
-
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
18160
|
+
const dataWrapped=window.WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
18161
18161
|
|
|
18162
18162
|
// We check if the message is in the right channel (channel information is stored in exchanged wrapped data) :
|
|
18163
18163
|
const channelName=this.channelName;
|
|
@@ -18166,7 +18166,7 @@ class ClientReceptionEntryPoint{
|
|
|
18166
18166
|
}
|
|
18167
18167
|
|
|
18168
18168
|
// We check if the message is in the right room (r)oom information is stored in client socket object) :
|
|
18169
|
-
if(!WebsocketImplementation.isInRoom(clientSocket, this.clientsRoomsTag)) return;
|
|
18169
|
+
if(!window.WebsocketImplementation.isInRoom(clientSocket, this.clientsRoomsTag)) return;
|
|
18170
18170
|
|
|
18171
18171
|
|
|
18172
18172
|
// We check if the message matches the required message type :
|
|
@@ -18278,9 +18278,9 @@ class ClientInstance{
|
|
|
18278
18278
|
|
|
18279
18279
|
// // FOR THE SOCKETIO IMPLEMENTATION :
|
|
18280
18280
|
// const clientSocket=this.clientSocket;
|
|
18281
|
-
// if(WebsocketImplementation.useSocketIOImplementation){
|
|
18282
|
-
if(WebsocketImplementation.implementationToUse){
|
|
18283
|
-
WebsocketImplementation.implementationToUse.initOnReceiveBrowserContext(channelNameParam, (eventOrMessage)=>{
|
|
18281
|
+
// if(window.WebsocketImplementation.useSocketIOImplementation){
|
|
18282
|
+
if(window.WebsocketImplementation.implementationToUse){
|
|
18283
|
+
window.WebsocketImplementation.implementationToUse.initOnReceiveBrowserContext(channelNameParam, (eventOrMessage)=>{
|
|
18284
18284
|
clientReceptionEntryPoint.execute(eventOrMessage, clientSocket, this.clientReceptionEntryPoints);
|
|
18285
18285
|
});
|
|
18286
18286
|
// clientSocket.on(channelNameParam, (eventOrMessage)=>{
|
|
@@ -18302,7 +18302,7 @@ class ClientInstance{
|
|
|
18302
18302
|
if(!isConnected(clientSocket)) return;
|
|
18303
18303
|
|
|
18304
18304
|
// Room information is stored in client socket object :
|
|
18305
|
-
if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
|
|
18305
|
+
if(!window.WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
|
|
18306
18306
|
|
|
18307
18307
|
// Channel information is stored in exchanged data :
|
|
18308
18308
|
let dataWrapped=saveClassesInformation({channelName:channelNameParam, data:data});
|
|
@@ -18312,11 +18312,11 @@ class ClientInstance{
|
|
|
18312
18312
|
// (Don't worry, the underlying sub-system will turn it back into Objects without you need to do anything!)
|
|
18313
18313
|
dataWrapped=stringifyObject(dataWrapped);
|
|
18314
18314
|
|
|
18315
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
18316
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
18315
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
18316
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
18317
18317
|
clientSocket.send(dataWrapped);
|
|
18318
18318
|
}else{
|
|
18319
|
-
WebsocketImplementation.implementationToUse.send(dataWrapped);
|
|
18319
|
+
window.WebsocketImplementation.implementationToUse.send(dataWrapped);
|
|
18320
18320
|
// clientSocket.emit(channelNameParam,dataWrapped);
|
|
18321
18321
|
}
|
|
18322
18322
|
|
|
@@ -18347,8 +18347,8 @@ class ClientInstance{
|
|
|
18347
18347
|
lognow("DEBUG : CLIENT : doOnConnection !");
|
|
18348
18348
|
|
|
18349
18349
|
const clientSocket=self.clientSocket;
|
|
18350
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
18351
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
18350
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
18351
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
18352
18352
|
// FOR THE WEBSOCKET IMPLEMENTATION :
|
|
18353
18353
|
clientSocket.addEventListener("message", (eventOrMessage)=>{
|
|
18354
18354
|
foreach(self.clientReceptionEntryPoints,(clientReceptionEntryPoint)=>{
|
|
@@ -18356,7 +18356,7 @@ class ClientInstance{
|
|
|
18356
18356
|
});
|
|
18357
18357
|
});
|
|
18358
18358
|
}else{
|
|
18359
|
-
WebsocketImplementation.implementationToUse.receive((eventOrMessage)=>{
|
|
18359
|
+
window.WebsocketImplementation.implementationToUse.receive((eventOrMessage)=>{
|
|
18360
18360
|
foreach(self.clientReceptionEntryPoints,(clientReceptionEntryPoint)=>{
|
|
18361
18361
|
clientReceptionEntryPoint.execute(eventOrMessage, clientSocket, self.clientReceptionEntryPoints);
|
|
18362
18362
|
});
|
|
@@ -18367,8 +18367,8 @@ class ClientInstance{
|
|
|
18367
18367
|
};
|
|
18368
18368
|
|
|
18369
18369
|
|
|
18370
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
18371
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
18370
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
18371
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
18372
18372
|
|
|
18373
18373
|
// FOR THE WEBSOCKET IMPLEMENTATION :
|
|
18374
18374
|
this.clientSocket.addEventListener("open",doAllOnConnection);
|
|
@@ -18380,9 +18380,9 @@ class ClientInstance{
|
|
|
18380
18380
|
}
|
|
18381
18381
|
|
|
18382
18382
|
}else{
|
|
18383
|
-
WebsocketImplementation.implementationToUse.initClientSocket(this.clientSocket);
|
|
18383
|
+
window.WebsocketImplementation.implementationToUse.initClientSocket(this.clientSocket);
|
|
18384
18384
|
if(!empty(this.onServerLostListeners)){
|
|
18385
|
-
WebsocketImplementation.implementationToUse.initOnClose(()=>{
|
|
18385
|
+
window.WebsocketImplementation.implementationToUse.initOnClose(()=>{
|
|
18386
18386
|
foreach(self.onServerLostListeners,l=>{l.execute(self.clientSocket);});
|
|
18387
18387
|
});
|
|
18388
18388
|
}
|
|
@@ -18445,13 +18445,13 @@ class ServerReceptionEntryPoint{
|
|
|
18445
18445
|
|
|
18446
18446
|
// With «ws» library we have no choive than register message events inside a «connection» event !
|
|
18447
18447
|
|
|
18448
|
-
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
18448
|
+
const dataWrapped=window.WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
18449
18449
|
|
|
18450
18450
|
// Channel information is stored in exchanged data :
|
|
18451
18451
|
if(dataWrapped.channelName!==this.channelName) return;
|
|
18452
18452
|
|
|
18453
18453
|
// Room information is stored in client socket object :
|
|
18454
|
-
const isClientInRoom=WebsocketImplementation.isInRoom(clientSocketParam, this.clientsRoomsTag);
|
|
18454
|
+
const isClientInRoom=window.WebsocketImplementation.isInRoom(clientSocketParam, this.clientsRoomsTag);
|
|
18455
18455
|
|
|
18456
18456
|
// // DBG
|
|
18457
18457
|
// lognow("(SERVER) isClientInRoom:",isClientInRoom);
|
|
@@ -18534,9 +18534,9 @@ class NodeServerInstance{
|
|
|
18534
18534
|
this.serverReceptionEntryPoints.push(serverReceptionEntryPoint);
|
|
18535
18535
|
|
|
18536
18536
|
// SPECIAL FOR THE SOCKETIO IMPLEMENTATION :
|
|
18537
|
-
// if(WebsocketImplementation.useSocketIOImplementation){
|
|
18538
|
-
if(WebsocketImplementation.implementationToUse){
|
|
18539
|
-
WebsocketImplementation.implementationToUse.initOnReceiveNodeContext(channelNameParam, serverReceptionEntryPoint);
|
|
18537
|
+
// if(window.WebsocketImplementation.useSocketIOImplementation){
|
|
18538
|
+
if(window.WebsocketImplementation.implementationToUse){
|
|
18539
|
+
window.WebsocketImplementation.implementationToUse.initOnReceiveNodeContext(channelNameParam, serverReceptionEntryPoint);
|
|
18540
18540
|
// const channelName=serverReceptionEntryPoint.channelName;
|
|
18541
18541
|
// clientSocket.on(channelName, (eventOrMessage)=>{
|
|
18542
18542
|
// serverReceptionEntryPoint.execute(eventOrMessage, clientSocket);
|
|
@@ -18559,11 +18559,11 @@ class NodeServerInstance{
|
|
|
18559
18559
|
lognow("(SERVER) (server sends to all clients)");
|
|
18560
18560
|
|
|
18561
18561
|
let serverClients;
|
|
18562
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
18563
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
18562
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
18563
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
18564
18564
|
serverClients=this.serverSocket.clients;
|
|
18565
18565
|
}else{
|
|
18566
|
-
WebsocketImplementation.implementationToUse.getServerClients();
|
|
18566
|
+
window.WebsocketImplementation.implementationToUse.getServerClients();
|
|
18567
18567
|
// serverClients=this.serverSocket.sockets.sockets;
|
|
18568
18568
|
}
|
|
18569
18569
|
|
|
@@ -18575,7 +18575,7 @@ class NodeServerInstance{
|
|
|
18575
18575
|
|
|
18576
18576
|
|
|
18577
18577
|
// Room information is stored in client socket object :
|
|
18578
|
-
if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
|
|
18578
|
+
if(!window.WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
|
|
18579
18579
|
|
|
18580
18580
|
// Channel information is stored in exchanged data :
|
|
18581
18581
|
let dataWrapped=saveClassesInformation({channelName:channelName, data:data});
|
|
@@ -18585,11 +18585,11 @@ class NodeServerInstance{
|
|
|
18585
18585
|
// (Don't worry, the underlying sub-system will turn it back into Objects without you need to do anything!)
|
|
18586
18586
|
dataWrapped=stringifyObject(dataWrapped);
|
|
18587
18587
|
|
|
18588
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
18589
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
18588
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
18589
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
18590
18590
|
clientSocket.send(dataWrapped);
|
|
18591
18591
|
}else{
|
|
18592
|
-
WebsocketImplementation.implementationToUse.serverSend(clientSocket, dataWrapped);
|
|
18592
|
+
window.WebsocketImplementation.implementationToUse.serverSend(clientSocket, dataWrapped);
|
|
18593
18593
|
// clientSocket.emit(channelName, dataWrapped);
|
|
18594
18594
|
}
|
|
18595
18595
|
|
|
@@ -18602,17 +18602,17 @@ class NodeServerInstance{
|
|
|
18602
18602
|
|
|
18603
18603
|
|
|
18604
18604
|
let clientSocket=clientSocketParam;
|
|
18605
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
18606
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
18605
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
18606
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
18607
18607
|
if(clientSocket.readyState!==WebSocket.OPEN) return;
|
|
18608
18608
|
}else{
|
|
18609
|
-
if(WebsocketImplementation.implementationToUse.isReady(clientSocket)) return;
|
|
18609
|
+
if(window.WebsocketImplementation.implementationToUse.isReady(clientSocket)) return;
|
|
18610
18610
|
// if(clientSocket.connected) return;
|
|
18611
18611
|
}
|
|
18612
18612
|
|
|
18613
18613
|
|
|
18614
18614
|
// Room information is stored in client socket object :
|
|
18615
|
-
if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
|
|
18615
|
+
if(!window.WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
|
|
18616
18616
|
|
|
18617
18617
|
// Channel information is stored in exchanged data :
|
|
18618
18618
|
let dataWrapped=saveClassesInformation({channelName:channelName, data:data});
|
|
@@ -18623,11 +18623,11 @@ class NodeServerInstance{
|
|
|
18623
18623
|
dataWrapped=stringifyObject(dataWrapped);
|
|
18624
18624
|
|
|
18625
18625
|
|
|
18626
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
18627
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
18626
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
18627
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
18628
18628
|
clientSocket.send(dataWrapped);
|
|
18629
18629
|
}else{
|
|
18630
|
-
WebsocketImplementation.implementationToUse.serverSend(clientSocket, dataWrapped);
|
|
18630
|
+
window.WebsocketImplementation.implementationToUse.serverSend(clientSocket, dataWrapped);
|
|
18631
18631
|
// clientSocket.emit(channelName,dataWrapped);
|
|
18632
18632
|
}
|
|
18633
18633
|
|
|
@@ -18660,11 +18660,11 @@ class NodeServerInstance{
|
|
|
18660
18660
|
});
|
|
18661
18661
|
};
|
|
18662
18662
|
|
|
18663
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
18664
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
18663
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
18664
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
18665
18665
|
clientSocket.addEventListener("message", doOnMessage);
|
|
18666
18666
|
}else{
|
|
18667
|
-
WebsocketImplementation.implementationToUse.initOnMessageReceived(doOnMessage);
|
|
18667
|
+
window.WebsocketImplementation.implementationToUse.initOnMessageReceived(doOnMessage);
|
|
18668
18668
|
}
|
|
18669
18669
|
|
|
18670
18670
|
doOnConnection(this, clientSocket);
|
|
@@ -18687,11 +18687,11 @@ class NodeServerInstance{
|
|
|
18687
18687
|
|
|
18688
18688
|
clientSocket.removeAllListeners();
|
|
18689
18689
|
|
|
18690
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
18691
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
18690
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
18691
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
18692
18692
|
clientSocket.terminate();
|
|
18693
18693
|
}else{
|
|
18694
|
-
WebsocketImplementation.implementationToUse.terminate();
|
|
18694
|
+
window.WebsocketImplementation.implementationToUse.terminate();
|
|
18695
18695
|
// clientSocket.emit("endConnection");
|
|
18696
18696
|
}
|
|
18697
18697
|
|
|
@@ -18711,12 +18711,12 @@ class NodeServerInstance{
|
|
|
18711
18711
|
|
|
18712
18712
|
clientSocket.isConnectionAlive=false;
|
|
18713
18713
|
|
|
18714
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
18715
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
18714
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
18715
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
18716
18716
|
// FOR THE WEBSOCKET IMPLEMENTATION :
|
|
18717
18717
|
clientSocket.ping();
|
|
18718
18718
|
}else{
|
|
18719
|
-
WebsocketImplementation.implementationToUse.ping();
|
|
18719
|
+
window.WebsocketImplementation.implementationToUse.ping();
|
|
18720
18720
|
// // FOR THE SOCKETIO IMPLEMENTATION :
|
|
18721
18721
|
// self.send("protocol",{type:"ping"}, null, clientSocket);
|
|
18722
18722
|
}
|
|
@@ -18726,14 +18726,14 @@ class NodeServerInstance{
|
|
|
18726
18726
|
|
|
18727
18727
|
|
|
18728
18728
|
// PING-PONG :
|
|
18729
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
18730
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
18729
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
18730
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
18731
18731
|
// FOR THE WEBSOCKET IMPLEMENTATION :
|
|
18732
18732
|
clientSocket.on("pong",()=>{
|
|
18733
18733
|
clientSocket.isConnectionAlive=true;
|
|
18734
18734
|
});
|
|
18735
18735
|
}else{
|
|
18736
|
-
WebsocketImplementation.implementationToUse.doOnPong(()=>{
|
|
18736
|
+
window.WebsocketImplementation.implementationToUse.doOnPong(()=>{
|
|
18737
18737
|
clientSocket.isConnectionAlive=true;
|
|
18738
18738
|
});
|
|
18739
18739
|
// // FOR THE SOCKETIO IMPLEMENTATION :
|
aotrautils/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1912",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "aotrautils",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.1912",
|
|
10
10
|
"license": "HGPL-1.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"atob": "^2.1.2",
|
aotrautils/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1912",
|
|
4
4
|
"main": "aotrautils.build.js",
|
|
5
5
|
"description": "A library for vanilla javascript utils (client-side) used in aotra javascript CMS",
|
|
6
6
|
"author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",
|