aotrautils-srv 0.0.1909 → 0.0.1911
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_29072022-2359 (26/07/2026-03:
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (26/07/2026-03:29:33)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -5470,7 +5470,7 @@ window.AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
5470
5470
|
|
|
5471
5471
|
|
|
5472
5472
|
|
|
5473
|
-
/*utils AI library associated with aotra version : «1_29072022-2359 (26/07/2026-03:
|
|
5473
|
+
/*utils AI library associated with aotra version : «1_29072022-2359 (26/07/2026-03:29:33)»*/
|
|
5474
5474
|
/*-----------------------------------------------------------------------------*/
|
|
5475
5475
|
|
|
5476
5476
|
|
|
@@ -5730,7 +5730,7 @@ window.getLLMAPIClient=(modelName, apiURL, agentRole, defaultPrompt, llmProvider
|
|
|
5730
5730
|
|
|
5731
5731
|
|
|
5732
5732
|
|
|
5733
|
-
/*utils CONSOLE library associated with aotra version : «1_29072022-2359 (26/07/2026-03:
|
|
5733
|
+
/*utils CONSOLE library associated with aotra version : «1_29072022-2359 (26/07/2026-03:29:33)»*/
|
|
5734
5734
|
/*-----------------------------------------------------------------------------*/
|
|
5735
5735
|
|
|
5736
5736
|
|
|
@@ -7849,10 +7849,10 @@ window.fileExists=(filePath)=>{
|
|
|
7849
7849
|
//- WEBSOCKETS AND NODEJS :
|
|
7850
7850
|
|
|
7851
7851
|
function isConnected(clientSocket){
|
|
7852
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
7853
|
-
if(!WebsocketImplementation.implementationToUse)
|
|
7852
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
7853
|
+
if(!window.WebsocketImplementation.implementationToUse)
|
|
7854
7854
|
return (clientSocket.readyState===WebSocket.OPEN)
|
|
7855
|
-
return WebsocketImplementation.implementationToUse.isConnected(clientSocket);
|
|
7855
|
+
return window.WebsocketImplementation.implementationToUse.isConnected(clientSocket);
|
|
7856
7856
|
// return (clientSocket.connected);
|
|
7857
7857
|
}
|
|
7858
7858
|
|
|
@@ -7982,7 +7982,7 @@ window.getConsoleCLI=(doOnCommands={"makeSandiwch":()=>{}}, promptText="Enter co
|
|
|
7982
7982
|
|
|
7983
7983
|
|
|
7984
7984
|
// NODE ONLY SERVER / CLIENTS :
|
|
7985
|
-
WebsocketImplementation={
|
|
7985
|
+
window.WebsocketImplementation={
|
|
7986
7986
|
|
|
7987
7987
|
|
|
7988
7988
|
isNodeContext:true,
|
|
@@ -8003,11 +8003,11 @@ WebsocketImplementation={
|
|
|
8003
8003
|
// , useSocketIOImplementation=/*DEBUG*/false
|
|
8004
8004
|
)=>{
|
|
8005
8005
|
|
|
8006
|
-
WebsocketImplementation.isNodeContext=isNodeContext;
|
|
8007
|
-
// WebsocketImplementation.useSocketIOImplementation=useSocketIOImplementation;
|
|
8006
|
+
window.WebsocketImplementation.isNodeContext=isNodeContext;
|
|
8007
|
+
// window.WebsocketImplementation.useSocketIOImplementation=useSocketIOImplementation;
|
|
8008
8008
|
|
|
8009
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
8010
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
8009
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
8010
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
8011
8011
|
|
|
8012
8012
|
// TRACE
|
|
8013
8013
|
lognow("INFO : (SERVER/CLIENT) Using native WebSocket implementation.");
|
|
@@ -8028,7 +8028,7 @@ WebsocketImplementation={
|
|
|
8028
8028
|
}
|
|
8029
8029
|
|
|
8030
8030
|
}else{
|
|
8031
|
-
window.WebSocket=WebsocketImplementation.implementationToUse.getSocketClass();
|
|
8031
|
+
window.WebSocket=window.WebsocketImplementation.implementationToUse.getSocketClass();
|
|
8032
8032
|
}
|
|
8033
8033
|
// // TRACE
|
|
8034
8034
|
// lognow("INFO : (SERVER/CLIENT) Using socket.io websocket implementation.");
|
|
@@ -8065,22 +8065,22 @@ WebsocketImplementation={
|
|
|
8065
8065
|
|
|
8066
8066
|
// *********************************************************************************
|
|
8067
8067
|
|
|
8068
|
-
return WebsocketImplementation;
|
|
8068
|
+
return window.WebsocketImplementation;
|
|
8069
8069
|
},
|
|
8070
8070
|
|
|
8071
8071
|
|
|
8072
8072
|
/*public*//*static*/getMessageDataBothImplementations:(eventOrMessageParam)=>{
|
|
8073
8073
|
|
|
8074
|
-
// const eventOrMessage=(!WebsocketImplementation.useSocketIOImplementation?eventOrMessageParam.data:eventOrMessageParam);
|
|
8074
|
+
// const eventOrMessage=(!window.WebsocketImplementation.useSocketIOImplementation?eventOrMessageParam.data:eventOrMessageParam);
|
|
8075
8075
|
const eventOrMessage=
|
|
8076
|
-
(!WebsocketImplementation.implementationToUse)?
|
|
8076
|
+
(!window.WebsocketImplementation.implementationToUse)?
|
|
8077
8077
|
eventOrMessageParam.data
|
|
8078
|
-
:WebsocketImplementation.implementationToUse.getData(eventOrMessageParam);
|
|
8078
|
+
:window.WebsocketImplementation.implementationToUse.getData(eventOrMessageParam);
|
|
8079
8079
|
|
|
8080
8080
|
let dataResult=eventOrMessage;
|
|
8081
8081
|
|
|
8082
8082
|
try{
|
|
8083
|
-
dataResult=(WebsocketImplementation.useFlatStrings || isString(eventOrMessage)?parseJSON(eventOrMessage):eventOrMessage);
|
|
8083
|
+
dataResult=(window.WebsocketImplementation.useFlatStrings || isString(eventOrMessage)?parseJSON(eventOrMessage):eventOrMessage);
|
|
8084
8084
|
}catch(error1){
|
|
8085
8085
|
// TRACE
|
|
8086
8086
|
lognow(`ERROR : Failed to parse JSON for string «${dataResult}»`,error1);
|
|
@@ -8093,15 +8093,15 @@ WebsocketImplementation={
|
|
|
8093
8093
|
|
|
8094
8094
|
getServer:(listenableServer)=>{
|
|
8095
8095
|
|
|
8096
|
-
if(!WebsocketImplementation.isNodeContext){
|
|
8096
|
+
if(!window.WebsocketImplementation.isNodeContext){
|
|
8097
8097
|
// TRACE
|
|
8098
8098
|
throw new Error("ERROR : SERVER : Server launch is not supported in a non-nodejs context for any implementation.");
|
|
8099
8099
|
}
|
|
8100
8100
|
|
|
8101
8101
|
// NODE SERVER MODE ONLY :
|
|
8102
8102
|
let serverSocket;
|
|
8103
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
8104
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
8103
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
8104
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
8105
8105
|
if(typeof(WebSocketServer)==="undefined")
|
|
8106
8106
|
window.WebSocketServer=require("ws");
|
|
8107
8107
|
if(typeof(WebSocketServer)==="undefined")
|
|
@@ -8119,7 +8119,7 @@ WebsocketImplementation={
|
|
|
8119
8119
|
});
|
|
8120
8120
|
|
|
8121
8121
|
}else{
|
|
8122
|
-
serverSocket=WebsocketImplementation.implementationToUse.getServerSocket(listenableServer);
|
|
8122
|
+
serverSocket=window.WebsocketImplementation.implementationToUse.getServerSocket(listenableServer);
|
|
8123
8123
|
|
|
8124
8124
|
//
|
|
8125
8125
|
// // Loading socket.io
|
|
@@ -8154,11 +8154,11 @@ WebsocketImplementation={
|
|
|
8154
8154
|
// To make the server aware of the clients connections states :
|
|
8155
8155
|
nodeServerInstance.serverSocket.on("close", function close() {
|
|
8156
8156
|
|
|
8157
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
8158
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
8157
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
8158
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
8159
8159
|
serverClients=nodeServerInstance.serverSocket.clients;
|
|
8160
8160
|
}else{
|
|
8161
|
-
serverClients=WebsocketImplementation.implementationToUse.getClientSockets();
|
|
8161
|
+
serverClients=window.WebsocketImplementation.implementationToUse.getClientSockets();
|
|
8162
8162
|
// serverClients=nodeServerInstance.serverSocket.sockets.sockets;
|
|
8163
8163
|
}
|
|
8164
8164
|
|
|
@@ -8175,12 +8175,12 @@ WebsocketImplementation={
|
|
|
8175
8175
|
connectToServer:(serverURL, port, isSecure=false, timeout)=>{
|
|
8176
8176
|
|
|
8177
8177
|
// TRACE
|
|
8178
|
-
lognow("INFO : Using socket library flavor : "+(WebsocketImplementation.isNodeContext?"node (client/server-side)":"browser (client-side only)"));
|
|
8178
|
+
lognow("INFO : Using socket library flavor : "+(window.WebsocketImplementation.isNodeContext?"node (client/server-side)":"browser (client-side only)"));
|
|
8179
8179
|
|
|
8180
|
-
if(WebsocketImplementation.isNodeContext)
|
|
8181
|
-
return WebsocketImplementation.connectToServerFromNode(serverURL, port, isSecure, timeout);
|
|
8180
|
+
if(window.WebsocketImplementation.isNodeContext)
|
|
8181
|
+
return window.WebsocketImplementation.connectToServerFromNode(serverURL, port, isSecure, timeout);
|
|
8182
8182
|
else
|
|
8183
|
-
return WebsocketImplementation.connectToServerFromBrowser(serverURL, port, isSecure, timeout);
|
|
8183
|
+
return window.WebsocketImplementation.connectToServerFromBrowser(serverURL, port, isSecure, timeout);
|
|
8184
8184
|
},
|
|
8185
8185
|
|
|
8186
8186
|
|
|
@@ -8191,8 +8191,8 @@ WebsocketImplementation={
|
|
|
8191
8191
|
|
|
8192
8192
|
// NODE CLIENT MODE ONLY :
|
|
8193
8193
|
let clientSocket;
|
|
8194
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
8195
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
8194
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
8195
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
8196
8196
|
|
|
8197
8197
|
// NEW : ws :
|
|
8198
8198
|
if(typeof(WebSocket)==="undefined"){
|
|
@@ -8221,11 +8221,11 @@ WebsocketImplementation={
|
|
|
8221
8221
|
});
|
|
8222
8222
|
|
|
8223
8223
|
}else{
|
|
8224
|
-
clientSocket=WebsocketImplementation.implementationToUse.getClientSocket(true);
|
|
8224
|
+
clientSocket=window.WebsocketImplementation.implementationToUse.getClientSocket(true);
|
|
8225
8225
|
|
|
8226
8226
|
// // NOW : socket.io :
|
|
8227
8227
|
// //client on server-side:
|
|
8228
|
-
// if(WebsocketImplementation.isNodeContext && typeof(io)!=="undefined"){
|
|
8228
|
+
// if(window.WebsocketImplementation.isNodeContext && typeof(io)!=="undefined"){
|
|
8229
8229
|
//// OLD SYNTAX: clientSocket=Socket.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
8230
8230
|
//// NO : clientSocket=new Socket.Client(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
8231
8231
|
// clientSocket=io(serverURL + ":" + port,{timeout: timeout, secure: isSecure, autoConnect:true});
|
|
@@ -8261,8 +8261,8 @@ WebsocketImplementation={
|
|
|
8261
8261
|
// BROWSER CLIENT MODE ONLY :
|
|
8262
8262
|
let clientSocket;
|
|
8263
8263
|
|
|
8264
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
8265
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
8264
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
8265
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
8266
8266
|
|
|
8267
8267
|
// CAUTION : PARAMETER rejectUnauthorized:false WILL DO NOTHING,
|
|
8268
8268
|
// BECAUSE THIS IS COMPLETLY HANDLED BY THE BROWSER SECURITY POLICY !
|
|
@@ -8277,7 +8277,7 @@ WebsocketImplementation={
|
|
|
8277
8277
|
});
|
|
8278
8278
|
}else{
|
|
8279
8279
|
// }else if(typeof(io)!=="undefined"){
|
|
8280
|
-
WebsocketImplementation.implementationToUse.getClientSocket();
|
|
8280
|
+
window.WebsocketImplementation.implementationToUse.getClientSocket();
|
|
8281
8281
|
// // OLD SYNTAX :clientSocket=io.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
8282
8282
|
// // ALTERNATIVE :
|
|
8283
8283
|
// clientSocket=io(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
@@ -8408,7 +8408,7 @@ window.launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=
|
|
|
8408
8408
|
}
|
|
8409
8409
|
|
|
8410
8410
|
|
|
8411
|
-
const server=WebsocketImplementation.getStatic(true).getServer(listenableServer);
|
|
8411
|
+
const server=window.WebsocketImplementation.getStatic(true).getServer(listenableServer);
|
|
8412
8412
|
|
|
8413
8413
|
// When a client connects, we execute the callback :
|
|
8414
8414
|
// CAUTION : MUST BE CALLED ONLY ONCE !
|
|
@@ -9089,41 +9089,41 @@ if(typeof(window)==="undefined") window=global;
|
|
|
9089
9089
|
// TODO : FIXME : DEVELOP...
|
|
9090
9090
|
// THIS IS HOW A implementationToUse FOR WEBSOCKET TECHNOLOGY MUST BE :
|
|
9091
9091
|
//
|
|
9092
|
-
//return WebsocketImplementation.implementationToUse.isConnected(clientSocket);
|
|
9092
|
+
//return window.WebsocketImplementation.implementationToUse.isConnected(clientSocket);
|
|
9093
9093
|
//
|
|
9094
|
-
//return WebsocketImplementation.implementationToUse.getSocketClass();
|
|
9094
|
+
//return window.WebsocketImplementation.implementationToUse.getSocketClass();
|
|
9095
9095
|
//
|
|
9096
|
-
//return WebsocketImplementation.implementationToUse.getData(eventOrMessageParam)
|
|
9097
|
-
// serverSocket=WebsocketImplementation.implementationToUse.getServerSocket(listenableServer);
|
|
9096
|
+
//return window.WebsocketImplementation.implementationToUse.getData(eventOrMessageParam)
|
|
9097
|
+
// serverSocket=window.WebsocketImplementation.implementationToUse.getServerSocket(listenableServer);
|
|
9098
9098
|
//
|
|
9099
|
-
//serverClients=WebsocketImplementation.implementationToUse.getClientSockets();
|
|
9099
|
+
//serverClients=window.WebsocketImplementation.implementationToUse.getClientSockets();
|
|
9100
9100
|
//
|
|
9101
|
-
//clientSocket=WebsocketImplementation.implementationToUse.getClientSocket(isNodeContext=true);
|
|
9101
|
+
//clientSocket=window.WebsocketImplementation.implementationToUse.getClientSocket(isNodeContext=true);
|
|
9102
9102
|
//
|
|
9103
|
-
//WebsocketImplementation.implementationToUse.send(dataWrapped);
|
|
9104
|
-
//WebsocketImplementation.implementationToUse.serverSend(clientSocket, dataWrapped);
|
|
9103
|
+
//window.WebsocketImplementation.implementationToUse.send(dataWrapped);
|
|
9104
|
+
//window.WebsocketImplementation.implementationToUse.serverSend(clientSocket, dataWrapped);
|
|
9105
9105
|
//
|
|
9106
|
-
//WebsocketImplementation.implementationToUse.receive((eventOrMessage)=>{ });
|
|
9106
|
+
//window.WebsocketImplementation.implementationToUse.receive((eventOrMessage)=>{ });
|
|
9107
9107
|
//
|
|
9108
9108
|
//
|
|
9109
|
-
//WebsocketImplementation.implementationToUse.initClientSocket(clientSocket);
|
|
9110
|
-
//WebsocketImplementation.implementationToUse.initOnClose(()=>{
|
|
9109
|
+
//window.WebsocketImplementation.implementationToUse.initClientSocket(clientSocket);
|
|
9110
|
+
//window.WebsocketImplementation.implementationToUse.initOnClose(()=>{
|
|
9111
9111
|
// foreach(self.onServerLostListeners,l=>{l.execute(self.clientSocket);});
|
|
9112
9112
|
//});
|
|
9113
9113
|
//
|
|
9114
|
-
//WebsocketImplementation.implementationToUse.initOnReceiveBrowserContext(channelNameParam, (eventOrMessage)=>{ });
|
|
9114
|
+
//window.WebsocketImplementation.implementationToUse.initOnReceiveBrowserContext(channelNameParam, (eventOrMessage)=>{ });
|
|
9115
9115
|
//
|
|
9116
|
-
//WebsocketImplementation.implementationToUse.initOnReceiveNodeContext(channelNameParam, serverReceptionEntryPoint);
|
|
9116
|
+
//window.WebsocketImplementation.implementationToUse.initOnReceiveNodeContext(channelNameParam, serverReceptionEntryPoint);
|
|
9117
9117
|
//
|
|
9118
|
-
//WebsocketImplementation.implementationToUse.getServerClients();
|
|
9118
|
+
//window.WebsocketImplementation.implementationToUse.getServerClients();
|
|
9119
9119
|
//
|
|
9120
|
-
//if(WebsocketImplementation.implementationToUse.isReady(clientSocket)) return;
|
|
9121
|
-
// WebsocketImplementation.implementationToUse.initOnMessageReceived(doOnMessage);
|
|
9122
|
-
// WebsocketImplementation.implementationToUse.terminate();
|
|
9120
|
+
//if(window.WebsocketImplementation.implementationToUse.isReady(clientSocket)) return;
|
|
9121
|
+
// window.WebsocketImplementation.implementationToUse.initOnMessageReceived(doOnMessage);
|
|
9122
|
+
// window.WebsocketImplementation.implementationToUse.terminate();
|
|
9123
9123
|
//
|
|
9124
|
-
//WebsocketImplementation.implementationToUse.ping();
|
|
9124
|
+
//window.WebsocketImplementation.implementationToUse.ping();
|
|
9125
9125
|
//
|
|
9126
|
-
//WebsocketImplementation.implementationToUse.doOnPong(()=>{
|
|
9126
|
+
//window.WebsocketImplementation.implementationToUse.doOnPong(()=>{
|
|
9127
9127
|
// clientSocket.isConnectionAlive=true;
|
|
9128
9128
|
//});
|
|
9129
9129
|
|
|
@@ -9150,7 +9150,7 @@ window.initClient=function(isNodeContext=true
|
|
|
9150
9150
|
// DBG
|
|
9151
9151
|
lognow("INFO : Setting up client :... (url:«"+url+"» ; port:«"+port+"»)");
|
|
9152
9152
|
|
|
9153
|
-
let socketToServerClientInstance=WebsocketImplementation.getStatic(isNodeContext
|
|
9153
|
+
let socketToServerClientInstance=window.WebsocketImplementation.getStatic(isNodeContext
|
|
9154
9154
|
// , useSocketIOImplementation
|
|
9155
9155
|
).connectToServer(url, port, isSecure, timeout);
|
|
9156
9156
|
if(!socketToServerClientInstance){
|
|
@@ -9248,7 +9248,7 @@ class ClientReceptionEntryPoint{
|
|
|
9248
9248
|
return;
|
|
9249
9249
|
}
|
|
9250
9250
|
|
|
9251
|
-
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
9251
|
+
const dataWrapped=window.WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
9252
9252
|
|
|
9253
9253
|
// We check if the message is in the right channel (channel information is stored in exchanged wrapped data) :
|
|
9254
9254
|
const channelName=this.channelName;
|
|
@@ -9257,7 +9257,7 @@ class ClientReceptionEntryPoint{
|
|
|
9257
9257
|
}
|
|
9258
9258
|
|
|
9259
9259
|
// We check if the message is in the right room (r)oom information is stored in client socket object) :
|
|
9260
|
-
if(!WebsocketImplementation.isInRoom(clientSocket, this.clientsRoomsTag)) return;
|
|
9260
|
+
if(!window.WebsocketImplementation.isInRoom(clientSocket, this.clientsRoomsTag)) return;
|
|
9261
9261
|
|
|
9262
9262
|
|
|
9263
9263
|
// We check if the message matches the required message type :
|
|
@@ -9369,9 +9369,9 @@ class ClientInstance{
|
|
|
9369
9369
|
|
|
9370
9370
|
// // FOR THE SOCKETIO IMPLEMENTATION :
|
|
9371
9371
|
// const clientSocket=this.clientSocket;
|
|
9372
|
-
// if(WebsocketImplementation.useSocketIOImplementation){
|
|
9373
|
-
if(WebsocketImplementation.implementationToUse){
|
|
9374
|
-
WebsocketImplementation.implementationToUse.initOnReceiveBrowserContext(channelNameParam, (eventOrMessage)=>{
|
|
9372
|
+
// if(window.WebsocketImplementation.useSocketIOImplementation){
|
|
9373
|
+
if(window.WebsocketImplementation.implementationToUse){
|
|
9374
|
+
window.WebsocketImplementation.implementationToUse.initOnReceiveBrowserContext(channelNameParam, (eventOrMessage)=>{
|
|
9375
9375
|
clientReceptionEntryPoint.execute(eventOrMessage, clientSocket, this.clientReceptionEntryPoints);
|
|
9376
9376
|
});
|
|
9377
9377
|
// clientSocket.on(channelNameParam, (eventOrMessage)=>{
|
|
@@ -9393,7 +9393,7 @@ class ClientInstance{
|
|
|
9393
9393
|
if(!isConnected(clientSocket)) return;
|
|
9394
9394
|
|
|
9395
9395
|
// Room information is stored in client socket object :
|
|
9396
|
-
if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
|
|
9396
|
+
if(!window.WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
|
|
9397
9397
|
|
|
9398
9398
|
// Channel information is stored in exchanged data :
|
|
9399
9399
|
let dataWrapped=saveClassesInformation({channelName:channelNameParam, data:data});
|
|
@@ -9403,11 +9403,11 @@ class ClientInstance{
|
|
|
9403
9403
|
// (Don't worry, the underlying sub-system will turn it back into Objects without you need to do anything!)
|
|
9404
9404
|
dataWrapped=stringifyObject(dataWrapped);
|
|
9405
9405
|
|
|
9406
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
9407
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
9406
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
9407
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
9408
9408
|
clientSocket.send(dataWrapped);
|
|
9409
9409
|
}else{
|
|
9410
|
-
WebsocketImplementation.implementationToUse.send(dataWrapped);
|
|
9410
|
+
window.WebsocketImplementation.implementationToUse.send(dataWrapped);
|
|
9411
9411
|
// clientSocket.emit(channelNameParam,dataWrapped);
|
|
9412
9412
|
}
|
|
9413
9413
|
|
|
@@ -9438,8 +9438,8 @@ class ClientInstance{
|
|
|
9438
9438
|
lognow("DEBUG : CLIENT : doOnConnection !");
|
|
9439
9439
|
|
|
9440
9440
|
const clientSocket=self.clientSocket;
|
|
9441
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
9442
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
9441
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
9442
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
9443
9443
|
// FOR THE WEBSOCKET IMPLEMENTATION :
|
|
9444
9444
|
clientSocket.addEventListener("message", (eventOrMessage)=>{
|
|
9445
9445
|
foreach(self.clientReceptionEntryPoints,(clientReceptionEntryPoint)=>{
|
|
@@ -9447,7 +9447,7 @@ class ClientInstance{
|
|
|
9447
9447
|
});
|
|
9448
9448
|
});
|
|
9449
9449
|
}else{
|
|
9450
|
-
WebsocketImplementation.implementationToUse.receive((eventOrMessage)=>{
|
|
9450
|
+
window.WebsocketImplementation.implementationToUse.receive((eventOrMessage)=>{
|
|
9451
9451
|
foreach(self.clientReceptionEntryPoints,(clientReceptionEntryPoint)=>{
|
|
9452
9452
|
clientReceptionEntryPoint.execute(eventOrMessage, clientSocket, self.clientReceptionEntryPoints);
|
|
9453
9453
|
});
|
|
@@ -9458,8 +9458,8 @@ class ClientInstance{
|
|
|
9458
9458
|
};
|
|
9459
9459
|
|
|
9460
9460
|
|
|
9461
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
9462
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
9461
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
9462
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
9463
9463
|
|
|
9464
9464
|
// FOR THE WEBSOCKET IMPLEMENTATION :
|
|
9465
9465
|
this.clientSocket.addEventListener("open",doAllOnConnection);
|
|
@@ -9471,9 +9471,9 @@ class ClientInstance{
|
|
|
9471
9471
|
}
|
|
9472
9472
|
|
|
9473
9473
|
}else{
|
|
9474
|
-
WebsocketImplementation.implementationToUse.initClientSocket(this.clientSocket);
|
|
9474
|
+
window.WebsocketImplementation.implementationToUse.initClientSocket(this.clientSocket);
|
|
9475
9475
|
if(!empty(this.onServerLostListeners)){
|
|
9476
|
-
WebsocketImplementation.implementationToUse.initOnClose(()=>{
|
|
9476
|
+
window.WebsocketImplementation.implementationToUse.initOnClose(()=>{
|
|
9477
9477
|
foreach(self.onServerLostListeners,l=>{l.execute(self.clientSocket);});
|
|
9478
9478
|
});
|
|
9479
9479
|
}
|
|
@@ -9536,13 +9536,13 @@ class ServerReceptionEntryPoint{
|
|
|
9536
9536
|
|
|
9537
9537
|
// With «ws» library we have no choive than register message events inside a «connection» event !
|
|
9538
9538
|
|
|
9539
|
-
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
9539
|
+
const dataWrapped=window.WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
9540
9540
|
|
|
9541
9541
|
// Channel information is stored in exchanged data :
|
|
9542
9542
|
if(dataWrapped.channelName!==this.channelName) return;
|
|
9543
9543
|
|
|
9544
9544
|
// Room information is stored in client socket object :
|
|
9545
|
-
const isClientInRoom=WebsocketImplementation.isInRoom(clientSocketParam, this.clientsRoomsTag);
|
|
9545
|
+
const isClientInRoom=window.WebsocketImplementation.isInRoom(clientSocketParam, this.clientsRoomsTag);
|
|
9546
9546
|
|
|
9547
9547
|
// // DBG
|
|
9548
9548
|
// lognow("(SERVER) isClientInRoom:",isClientInRoom);
|
|
@@ -9625,9 +9625,9 @@ class NodeServerInstance{
|
|
|
9625
9625
|
this.serverReceptionEntryPoints.push(serverReceptionEntryPoint);
|
|
9626
9626
|
|
|
9627
9627
|
// SPECIAL FOR THE SOCKETIO IMPLEMENTATION :
|
|
9628
|
-
// if(WebsocketImplementation.useSocketIOImplementation){
|
|
9629
|
-
if(WebsocketImplementation.implementationToUse){
|
|
9630
|
-
WebsocketImplementation.implementationToUse.initOnReceiveNodeContext(channelNameParam, serverReceptionEntryPoint);
|
|
9628
|
+
// if(window.WebsocketImplementation.useSocketIOImplementation){
|
|
9629
|
+
if(window.WebsocketImplementation.implementationToUse){
|
|
9630
|
+
window.WebsocketImplementation.implementationToUse.initOnReceiveNodeContext(channelNameParam, serverReceptionEntryPoint);
|
|
9631
9631
|
// const channelName=serverReceptionEntryPoint.channelName;
|
|
9632
9632
|
// clientSocket.on(channelName, (eventOrMessage)=>{
|
|
9633
9633
|
// serverReceptionEntryPoint.execute(eventOrMessage, clientSocket);
|
|
@@ -9650,11 +9650,11 @@ class NodeServerInstance{
|
|
|
9650
9650
|
lognow("(SERVER) (server sends to all clients)");
|
|
9651
9651
|
|
|
9652
9652
|
let serverClients;
|
|
9653
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
9654
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
9653
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
9654
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
9655
9655
|
serverClients=this.serverSocket.clients;
|
|
9656
9656
|
}else{
|
|
9657
|
-
WebsocketImplementation.implementationToUse.getServerClients();
|
|
9657
|
+
window.WebsocketImplementation.implementationToUse.getServerClients();
|
|
9658
9658
|
// serverClients=this.serverSocket.sockets.sockets;
|
|
9659
9659
|
}
|
|
9660
9660
|
|
|
@@ -9666,7 +9666,7 @@ class NodeServerInstance{
|
|
|
9666
9666
|
|
|
9667
9667
|
|
|
9668
9668
|
// Room information is stored in client socket object :
|
|
9669
|
-
if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
|
|
9669
|
+
if(!window.WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
|
|
9670
9670
|
|
|
9671
9671
|
// Channel information is stored in exchanged data :
|
|
9672
9672
|
let dataWrapped=saveClassesInformation({channelName:channelName, data:data});
|
|
@@ -9676,11 +9676,11 @@ class NodeServerInstance{
|
|
|
9676
9676
|
// (Don't worry, the underlying sub-system will turn it back into Objects without you need to do anything!)
|
|
9677
9677
|
dataWrapped=stringifyObject(dataWrapped);
|
|
9678
9678
|
|
|
9679
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
9680
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
9679
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
9680
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
9681
9681
|
clientSocket.send(dataWrapped);
|
|
9682
9682
|
}else{
|
|
9683
|
-
WebsocketImplementation.implementationToUse.serverSend(clientSocket, dataWrapped);
|
|
9683
|
+
window.WebsocketImplementation.implementationToUse.serverSend(clientSocket, dataWrapped);
|
|
9684
9684
|
// clientSocket.emit(channelName, dataWrapped);
|
|
9685
9685
|
}
|
|
9686
9686
|
|
|
@@ -9693,17 +9693,17 @@ class NodeServerInstance{
|
|
|
9693
9693
|
|
|
9694
9694
|
|
|
9695
9695
|
let clientSocket=clientSocketParam;
|
|
9696
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
9697
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
9696
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
9697
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
9698
9698
|
if(clientSocket.readyState!==WebSocket.OPEN) return;
|
|
9699
9699
|
}else{
|
|
9700
|
-
if(WebsocketImplementation.implementationToUse.isReady(clientSocket)) return;
|
|
9700
|
+
if(window.WebsocketImplementation.implementationToUse.isReady(clientSocket)) return;
|
|
9701
9701
|
// if(clientSocket.connected) return;
|
|
9702
9702
|
}
|
|
9703
9703
|
|
|
9704
9704
|
|
|
9705
9705
|
// Room information is stored in client socket object :
|
|
9706
|
-
if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
|
|
9706
|
+
if(!window.WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
|
|
9707
9707
|
|
|
9708
9708
|
// Channel information is stored in exchanged data :
|
|
9709
9709
|
let dataWrapped=saveClassesInformation({channelName:channelName, data:data});
|
|
@@ -9714,11 +9714,11 @@ class NodeServerInstance{
|
|
|
9714
9714
|
dataWrapped=stringifyObject(dataWrapped);
|
|
9715
9715
|
|
|
9716
9716
|
|
|
9717
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
9718
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
9717
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
9718
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
9719
9719
|
clientSocket.send(dataWrapped);
|
|
9720
9720
|
}else{
|
|
9721
|
-
WebsocketImplementation.implementationToUse.serverSend(clientSocket, dataWrapped);
|
|
9721
|
+
window.WebsocketImplementation.implementationToUse.serverSend(clientSocket, dataWrapped);
|
|
9722
9722
|
// clientSocket.emit(channelName,dataWrapped);
|
|
9723
9723
|
}
|
|
9724
9724
|
|
|
@@ -9751,11 +9751,11 @@ class NodeServerInstance{
|
|
|
9751
9751
|
});
|
|
9752
9752
|
};
|
|
9753
9753
|
|
|
9754
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
9755
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
9754
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
9755
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
9756
9756
|
clientSocket.addEventListener("message", doOnMessage);
|
|
9757
9757
|
}else{
|
|
9758
|
-
WebsocketImplementation.implementationToUse.initOnMessageReceived(doOnMessage);
|
|
9758
|
+
window.WebsocketImplementation.implementationToUse.initOnMessageReceived(doOnMessage);
|
|
9759
9759
|
}
|
|
9760
9760
|
|
|
9761
9761
|
doOnConnection(this, clientSocket);
|
|
@@ -9778,11 +9778,11 @@ class NodeServerInstance{
|
|
|
9778
9778
|
|
|
9779
9779
|
clientSocket.removeAllListeners();
|
|
9780
9780
|
|
|
9781
|
-
// if(!WebsocketImplementation.useSocketIOImplementation)
|
|
9782
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
9781
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation)
|
|
9782
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
9783
9783
|
clientSocket.terminate();
|
|
9784
9784
|
}else{
|
|
9785
|
-
WebsocketImplementation.implementationToUse.terminate();
|
|
9785
|
+
window.WebsocketImplementation.implementationToUse.terminate();
|
|
9786
9786
|
// clientSocket.emit("endConnection");
|
|
9787
9787
|
}
|
|
9788
9788
|
|
|
@@ -9802,12 +9802,12 @@ class NodeServerInstance{
|
|
|
9802
9802
|
|
|
9803
9803
|
clientSocket.isConnectionAlive=false;
|
|
9804
9804
|
|
|
9805
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
9806
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
9805
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
9806
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
9807
9807
|
// FOR THE WEBSOCKET IMPLEMENTATION :
|
|
9808
9808
|
clientSocket.ping();
|
|
9809
9809
|
}else{
|
|
9810
|
-
WebsocketImplementation.implementationToUse.ping();
|
|
9810
|
+
window.WebsocketImplementation.implementationToUse.ping();
|
|
9811
9811
|
// // FOR THE SOCKETIO IMPLEMENTATION :
|
|
9812
9812
|
// self.send("protocol",{type:"ping"}, null, clientSocket);
|
|
9813
9813
|
}
|
|
@@ -9817,14 +9817,14 @@ class NodeServerInstance{
|
|
|
9817
9817
|
|
|
9818
9818
|
|
|
9819
9819
|
// PING-PONG :
|
|
9820
|
-
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
9821
|
-
if(!WebsocketImplementation.implementationToUse){
|
|
9820
|
+
// if(!window.WebsocketImplementation.useSocketIOImplementation){
|
|
9821
|
+
if(!window.WebsocketImplementation.implementationToUse){
|
|
9822
9822
|
// FOR THE WEBSOCKET IMPLEMENTATION :
|
|
9823
9823
|
clientSocket.on("pong",()=>{
|
|
9824
9824
|
clientSocket.isConnectionAlive=true;
|
|
9825
9825
|
});
|
|
9826
9826
|
}else{
|
|
9827
|
-
WebsocketImplementation.implementationToUse.doOnPong(()=>{
|
|
9827
|
+
window.WebsocketImplementation.implementationToUse.doOnPong(()=>{
|
|
9828
9828
|
clientSocket.isConnectionAlive=true;
|
|
9829
9829
|
});
|
|
9830
9830
|
// // FOR THE SOCKETIO IMPLEMENTATION :
|
aotrautils-srv/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1911",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "aotrautils-srv",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.1911",
|
|
10
10
|
"license": "HGPL-1.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"atob": "^2.1.2",
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1911",
|
|
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)",
|