aotrautils-srv 0.0.290 → 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-21:10:48)»*/
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-21:10:48)»*/
4830
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (27/11/2022-22:11:00)»*/
4831
4831
  /*-----------------------------------------------------------------------------*/
4832
4832
 
4833
4833
 
@@ -5204,56 +5204,42 @@ 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
+ const clientSocket=clientSocketParam;
5229
+
5251
5230
 
5252
- if(!WebsocketImplementation.useSocketIOImplementation) clientSocketParam.addEventListener("message", doOnMessage);
5253
- else clientSocketParam.on(channelName, doOnMessage);
5231
+ // TODO : FIXME : Use one single interface !
5232
+ // Room information is stored in client socket object :
5233
+ const isClientInRoom=WebsocketImplementation.isInRoom(clientSocket, receptionEntryPoint.clientsRoomsTag);
5254
5234
 
5235
+ // DBG
5236
+ lognow("(SERVER) isClientInRoom:",isClientInRoom);
5255
5237
 
5238
+ if(!isClientInRoom) return;
5256
5239
 
5240
+ // DBG
5241
+ lognow("(SERVER) doOnIncomingMessage:",doOnIncomingMessage);
5242
+ if(doOnIncomingMessage) doOnIncomingMessage(dataWrapped.data, clientSocket);
5257
5243
 
5258
5244
 
5259
5245
  },
@@ -5356,15 +5342,38 @@ WebsocketImplementation={
5356
5342
  // console.log("nodeServerInstance.receptionEntryPoints.length:",nodeServerInstance.receptionEntryPoints.length);
5357
5343
 
5358
5344
 
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
- });
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
+
5368
5377
 
5369
5378
 
5370
5379
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.290",
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)",