aotrautils-srv 0.0.289 → 0.0.291
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 (27/11/2022-
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (27/11/2022-22:11:00)»*/
|
|
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 (27/11/2022-
|
|
4830
|
+
/*utils SERVER library associated with aotra version : «1_29072022-2359 (27/11/2022-22:11:00)»*/
|
|
4831
4831
|
/*-----------------------------------------------------------------------------*/
|
|
4832
4832
|
|
|
4833
4833
|
|
|
@@ -5191,6 +5191,10 @@ WebsocketImplementation={
|
|
|
5191
5191
|
|
|
5192
5192
|
receive:(channelName, doOnIncomingMessage, clientsRoomsTag=null)=>{
|
|
5193
5193
|
|
|
5194
|
+
// DBG
|
|
5195
|
+
lognow("(SERVER) Registering receive for «"+channelName+"»...",doOnIncomingMessage);
|
|
5196
|
+
|
|
5197
|
+
|
|
5194
5198
|
const receptionEntryPoint={
|
|
5195
5199
|
channelName:channelName,
|
|
5196
5200
|
clientsRoomsTag:clientsRoomsTag,
|
|
@@ -5200,58 +5204,42 @@ WebsocketImplementation={
|
|
|
5200
5204
|
// With «ws» library we have no choive than register message events inside a «connection» event !
|
|
5201
5205
|
// nodeServerInstance.onConnectionToClient((serverParam, clientSocketParam)=>{
|
|
5202
5206
|
|
|
5203
|
-
// TODO : Find a way to remove this !
|
|
5204
|
-
const doOnMessage=(eventOrMessage)=>{
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
// DBG
|
|
5208
|
-
lognow("(SERVER) RECEIVED SOMETHING FROM CLIENT...");
|
|
5209
|
-
|
|
5210
|
-
// dataWrapped=JSON.parse(dataWrapped);
|
|
5211
|
-
// dataWrapped=getAt(dataWrapped,0);// We get the root element
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
5215
5207
|
|
|
5216
5208
|
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
if(dataWrapped.channelName!==receptionEntryPoint.channelName) return;
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
const clientSocket=clientSocketParam;
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
// TODO : FIXME : Use one single interface !
|
|
5231
|
-
// Room information is stored in client socket object :
|
|
5232
|
-
const isClientInRoom=WebsocketImplementation.isInRoom(clientSocket, receptionEntryPoint.clientsRoomsTag);
|
|
5233
|
-
|
|
5234
|
-
// DBG
|
|
5235
|
-
lognow("(SERVER) isClientInRoom:",isClientInRoom);
|
|
5236
|
-
|
|
5237
|
-
if(!isClientInRoom) return;
|
|
5238
|
-
|
|
5239
|
-
// DBG
|
|
5240
|
-
lognow("(SERVER) doOnIncomingMessage:",doOnIncomingMessage);
|
|
5241
|
-
|
|
5242
|
-
doOnIncomingMessage(dataWrapped.data, clientSocket);
|
|
5243
|
-
|
|
5244
|
-
};
|
|
5245
|
-
|
|
5209
|
+
// DBG
|
|
5210
|
+
lognow("(SERVER) RECEIVED SOMETHING FROM CLIENT...");
|
|
5211
|
+
|
|
5212
|
+
// dataWrapped=JSON.parse(dataWrapped);
|
|
5213
|
+
// dataWrapped=getAt(dataWrapped,0);// We get the root element
|
|
5214
|
+
|
|
5246
5215
|
|
|
5216
|
+
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
5247
5217
|
|
|
5248
|
-
|
|
5218
|
+
|
|
5219
|
+
// DBG
|
|
5220
|
+
lognow("(SERVER) dataWrapped.channelName:",dataWrapped.channelName);
|
|
5221
|
+
lognow("(SERVER) receptionEntryPoint.channelName:",receptionEntryPoint.channelName);
|
|
5222
|
+
|
|
5249
5223
|
|
|
5250
|
-
|
|
5251
|
-
|
|
5224
|
+
// Channel information is stored in exchanged data :
|
|
5225
|
+
if(dataWrapped.channelName!==receptionEntryPoint.channelName) return;
|
|
5226
|
+
|
|
5252
5227
|
|
|
5228
|
+
const clientSocket=clientSocketParam;
|
|
5253
5229
|
|
|
5254
5230
|
|
|
5231
|
+
// TODO : FIXME : Use one single interface !
|
|
5232
|
+
// Room information is stored in client socket object :
|
|
5233
|
+
const isClientInRoom=WebsocketImplementation.isInRoom(clientSocket, receptionEntryPoint.clientsRoomsTag);
|
|
5234
|
+
|
|
5235
|
+
// DBG
|
|
5236
|
+
lognow("(SERVER) isClientInRoom:",isClientInRoom);
|
|
5237
|
+
|
|
5238
|
+
if(!isClientInRoom) return;
|
|
5239
|
+
|
|
5240
|
+
// DBG
|
|
5241
|
+
lognow("(SERVER) doOnIncomingMessage:",doOnIncomingMessage);
|
|
5242
|
+
if(doOnIncomingMessage) doOnIncomingMessage(dataWrapped.data, clientSocket);
|
|
5255
5243
|
|
|
5256
5244
|
|
|
5257
5245
|
},
|
|
@@ -5354,15 +5342,38 @@ WebsocketImplementation={
|
|
|
5354
5342
|
// console.log("nodeServerInstance.receptionEntryPoints.length:",nodeServerInstance.receptionEntryPoints.length);
|
|
5355
5343
|
|
|
5356
5344
|
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5345
|
+
|
|
5346
|
+
|
|
5347
|
+
////
|
|
5348
|
+
|
|
5349
|
+
doOnMessage=()=>{
|
|
5350
|
+
|
|
5351
|
+
|
|
5352
|
+
|
|
5353
|
+
// We execute the events registration listeners entry points:
|
|
5354
|
+
foreach(nodeServerInstance.receptionEntryPoints,(receptionEntryPoint,i)=>{
|
|
5355
|
+
|
|
5356
|
+
// DBG
|
|
5357
|
+
console.log("(SERVER) ENTRY POINT ["+i+"] is executed !");
|
|
5358
|
+
|
|
5359
|
+
receptionEntryPoint.execute(clientSocket);
|
|
5360
|
+
});
|
|
5361
|
+
|
|
5362
|
+
};
|
|
5363
|
+
|
|
5364
|
+
|
|
5365
|
+
if(!WebsocketImplementation.useSocketIOImplementation) clientSocketParam.addEventListener("message", doOnMessage);
|
|
5366
|
+
else clientSocketParam.on(channelName, doOnMessage);
|
|
5367
|
+
|
|
5368
|
+
|
|
5369
|
+
|
|
5370
|
+
|
|
5371
|
+
|
|
5372
|
+
|
|
5373
|
+
|
|
5374
|
+
|
|
5375
|
+
|
|
5376
|
+
|
|
5366
5377
|
|
|
5367
5378
|
|
|
5368
5379
|
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.291",
|
|
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)",
|