aotrautils-srv 0.0.323 → 0.0.324
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 (04/12/2022-
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (04/12/2022-13:37:57)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -4827,7 +4827,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
4827
4827
|
|
|
4828
4828
|
|
|
4829
4829
|
|
|
4830
|
-
/*utils SERVER library associated with aotra version : «1_29072022-2359 (04/12/2022-
|
|
4830
|
+
/*utils SERVER library associated with aotra version : «1_29072022-2359 (04/12/2022-13:37:57)»*/
|
|
4831
4831
|
/*-----------------------------------------------------------------------------*/
|
|
4832
4832
|
|
|
4833
4833
|
|
|
@@ -5184,7 +5184,7 @@ WebsocketImplementation={
|
|
|
5184
5184
|
clientPingIntervalMillis:5000,
|
|
5185
5185
|
// clientsSockets:[],
|
|
5186
5186
|
serverSocket:serverSocket,
|
|
5187
|
-
|
|
5187
|
+
receptionEntryPointsByClient:{},
|
|
5188
5188
|
|
|
5189
5189
|
receive:(channelNameParam, doOnIncomingMessage, clientsRoomsTag=null)=>{
|
|
5190
5190
|
|
|
@@ -5192,10 +5192,11 @@ WebsocketImplementation={
|
|
|
5192
5192
|
lognow("(SERVER) Registering receive for «"+channelNameParam+"»...",doOnIncomingMessage);
|
|
5193
5193
|
|
|
5194
5194
|
|
|
5195
|
+
|
|
5195
5196
|
const receptionEntryPoint={
|
|
5196
5197
|
channelName:channelNameParam,
|
|
5197
5198
|
clientsRoomsTag:clientsRoomsTag,
|
|
5198
|
-
execute:(eventOrMessage, clientSocketParam)=>{
|
|
5199
|
+
execute:(eventOrMessage, clientSocketParam, clientId)=>{
|
|
5199
5200
|
|
|
5200
5201
|
// With «ws» library we have no choive than register message events inside a «connection» event !
|
|
5201
5202
|
|
|
@@ -5241,12 +5242,11 @@ WebsocketImplementation={
|
|
|
5241
5242
|
};
|
|
5242
5243
|
|
|
5243
5244
|
|
|
5244
|
-
nodeServerInstance.
|
|
5245
|
+
if(!nodeServerInstance.receptionEntryPointsByClient[clientId])
|
|
5246
|
+
nodeServerInstance.receptionEntryPointsByClient[clientId]=[];
|
|
5247
|
+
nodeServerInstance.receptionEntryPointsByClient[clientId].push(receptionEntryPoint);
|
|
5245
5248
|
|
|
5246
5249
|
|
|
5247
|
-
// // DBG
|
|
5248
|
-
// console.log("ADD RECEPTION ENTRY POINT channelName:«"+channelName+"»! nodeServerInstance.receptionEntryPoints.length:",nodeServerInstance.receptionEntryPoints.length);
|
|
5249
|
-
|
|
5250
5250
|
|
|
5251
5251
|
return nodeServerInstance;
|
|
5252
5252
|
},
|
|
@@ -5343,20 +5343,18 @@ WebsocketImplementation={
|
|
|
5343
5343
|
// if(contains(nodeServerInstance.clientsSockets, clientSocket)) return;
|
|
5344
5344
|
// nodeServerInstance.clientsSockets.push(clientSocket);
|
|
5345
5345
|
|
|
5346
|
+
const clientId=getUUID();
|
|
5347
|
+
clientSocket.clientId=clientId;
|
|
5346
5348
|
|
|
5347
|
-
// DBG
|
|
5348
|
-
clientSocket.clientId=getUUID();
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
// // DBG
|
|
5352
|
-
// console.log("nodeServerInstance.receptionEntryPoints.length:",nodeServerInstance.receptionEntryPoints.length);
|
|
5353
5349
|
|
|
5354
5350
|
|
|
5355
5351
|
const doOnMessage=(eventOrMessage)=>{
|
|
5356
5352
|
|
|
5357
5353
|
// We execute the events registration listeners entry points:
|
|
5358
|
-
|
|
5359
|
-
|
|
5354
|
+
if(!nodeServerInstance.receptionEntryPointsByClient[clientId])
|
|
5355
|
+
return;
|
|
5356
|
+
foreach(nodeServerInstance.receptionEntryPointsByClient[clientId],(receptionEntryPoint,i)=>{
|
|
5357
|
+
receptionEntryPoint.execute(eventOrMessage, clientSocket, clientId);
|
|
5360
5358
|
});
|
|
5361
5359
|
|
|
5362
5360
|
};
|
|
@@ -5381,7 +5379,10 @@ WebsocketImplementation={
|
|
|
5381
5379
|
|
|
5382
5380
|
|
|
5383
5381
|
// On today, this method is named as same for the two implementations :
|
|
5382
|
+
// TRACE
|
|
5383
|
+
lognow("(SERVER) Removing all listeners and receptjion entrypoints for client socket «"+clientSocket.clientId+"».");
|
|
5384
5384
|
clientSocket.removeAllListeners();
|
|
5385
|
+
nodeServerInstance.receptionEntryPointsByClient[clientSocket.clientId]=[];
|
|
5385
5386
|
|
|
5386
5387
|
|
|
5387
5388
|
// TODO : FIXME : Use one single interface !
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.324",
|
|
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)",
|