aotrautils-srv 0.0.290 → 0.0.292

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