aotrautils-srv 0.0.503 → 0.0.504

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 (05/02/2023-14:51:22)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (05/02/2023-20:34:37)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4866,7 +4866,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4866
4866
 
4867
4867
 
4868
4868
 
4869
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (05/02/2023-14:51:22)»*/
4869
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (05/02/2023-20:34:37)»*/
4870
4870
  /*-----------------------------------------------------------------------------*/
4871
4871
 
4872
4872
 
@@ -5029,9 +5029,9 @@ if(typeof(fs)==="undefined"){
5029
5029
  //- WEBSOCKETS AND NODEJS :
5030
5030
 
5031
5031
  function isConnected(clientSocket){
5032
- if(!WebsocketImplementation.useSocketIOImplementation) if(clientSocket.readyState===WebSocket.OPEN) return true;
5033
- else if(clientSocket.connected) return true;
5034
- return false;
5032
+ if(!WebsocketImplementation.useSocketIOImplementation)
5033
+ return (clientSocket.readyState===WebSocket.OPEN)
5034
+ return (clientSocket.connected);
5035
5035
  }
5036
5036
 
5037
5037
 
@@ -5296,6 +5296,14 @@ WebsocketImplementation={
5296
5296
 
5297
5297
  nodeServerInstance.receptionEntryPoints.push(receptionEntryPoint);
5298
5298
 
5299
+ // SPECIAL FOR THE SOCKETIO IMPLEMENTATION :
5300
+ if(WebsocketImplementation.useSocketIOImplementation){
5301
+ const channelName=receptionEntryPoint.channelName;
5302
+ clientSocket.on(channelName, (eventOrMessage)=>{
5303
+ receptionEntryPoint.execute(eventOrMessage, clientSocket);
5304
+ });
5305
+ }
5306
+
5299
5307
 
5300
5308
  // // DBG
5301
5309
  // console.log("ADD RECEPTION ENTRY POINT channelName:«"+channelName+"»! nodeServerInstance.receptionEntryPoints.length:",nodeServerInstance.receptionEntryPoints.length);
@@ -5409,15 +5417,8 @@ WebsocketImplementation={
5409
5417
  });
5410
5418
  };
5411
5419
 
5412
- if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.addEventListener("message", doOnMessage);
5413
- else{
5420
+ if(!WebsocketImplementation.useSocketIOImplementation){ clientSocket.addEventListener("message", doOnMessage);
5414
5421
  // NO: else clientSocket.on("message", doOnMessage);
5415
- foreach(nodeServerInstance.receptionEntryPoints,(receptionEntryPoint,i)=>{
5416
- const channelName=receptionEntryPoint.channelName;
5417
- clientSocket.on(channelName, (eventOrMessage)=>{
5418
- receptionEntryPoint.execute(eventOrMessage, clientSocket);
5419
- });
5420
- });
5421
5422
  }
5422
5423
 
5423
5424
  doOnConnection(nodeServerInstance, clientSocket);
@@ -5629,6 +5630,15 @@ WebsocketImplementation={
5629
5630
 
5630
5631
  nodeClientInstance.receptionEntryPoints.push(receptionEntryPoint);
5631
5632
 
5633
+ // SPECIAL FOR THE SOCKETIO IMPLEMENTATION :
5634
+ if(WebsocketImplementation.useSocketIOImplementation){
5635
+ const channelName=receptionEntryPoint.channelName;
5636
+ clientSocket.on(channelName, (eventOrMessage)=>{
5637
+ receptionEntryPoint.execute(eventOrMessage, clientSocket);
5638
+ });
5639
+ }
5640
+
5641
+
5632
5642
  return nodeClientInstance;
5633
5643
  },
5634
5644
 
@@ -5706,15 +5716,8 @@ WebsocketImplementation={
5706
5716
  };
5707
5717
 
5708
5718
  const clientSocket=nodeClientInstance.clientSocket;
5709
- if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.addEventListener("message", doOnMessage);
5710
- else{
5719
+ if(!WebsocketImplementation.useSocketIOImplementation){ clientSocket.addEventListener("message", doOnMessage);
5711
5720
  // NO: else clientSocket.on("message", doOnMessage);
5712
- foreach(nodeClientInstance.receptionEntryPoints,(receptionEntryPoint,i)=>{
5713
- const channelName=receptionEntryPoint.channelName;
5714
- clientSocket.on(channelName, (eventOrMessage)=>{
5715
- receptionEntryPoint.execute(eventOrMessage, clientSocket);
5716
- });
5717
- });
5718
5721
  }
5719
5722
 
5720
5723
  doOnConnection(nodeClientInstance, clientSocket);
@@ -5799,8 +5802,8 @@ WebsocketImplementation={
5799
5802
 
5800
5803
  const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
5801
5804
 
5802
- // // DBG
5803
- // lognow("(CLIENT) (DEBUG) CLIENT RECEIVED SOMETHING FROM SERVER :",dataWrapped);
5805
+ // // DBG
5806
+ // lognow("(CLIENT) (DEBUG) CLIENT RECEIVED SOMETHING FROM SERVER :",dataWrapped);
5804
5807
 
5805
5808
  // Channel information is stored in exchanged data :
5806
5809
  if(dataWrapped.channelName && dataWrapped.channelName!==channelNameParam) return;
@@ -5827,6 +5830,14 @@ WebsocketImplementation={
5827
5830
  if(!contains(browserInstance.receptionEntryPoints,(l)=>(l.id && receptionEntryPoint.id && l.id===receptionEntryPoint.id)))
5828
5831
  browserInstance.receptionEntryPoints.push(receptionEntryPoint);
5829
5832
 
5833
+ // SPECIAL FOR THE SOCKETIO IMPLEMENTATION :
5834
+ if(WebsocketImplementation.useSocketIOImplementation){
5835
+ const channelName=receptionEntryPoint.channelName;
5836
+ clientSocket.on(channelName, (eventOrMessage)=>{
5837
+ receptionEntryPoint.execute(eventOrMessage, clientSocket);
5838
+ });
5839
+ }
5840
+
5830
5841
 
5831
5842
  return browserInstance;
5832
5843
  },
@@ -5948,15 +5959,8 @@ WebsocketImplementation={
5948
5959
  };
5949
5960
 
5950
5961
  const clientSocket=browserInstance.clientSocket;
5951
- if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.addEventListener("message", doOnMessage);
5952
- else{
5962
+ if(!WebsocketImplementation.useSocketIOImplementation){ clientSocket.addEventListener("message", doOnMessage);
5953
5963
  // NO: else clientSocket.on("message", doOnMessage);
5954
- foreach(browserInstance.receptionEntryPoints,(receptionEntryPoint,i)=>{
5955
- const channelName=receptionEntryPoint.channelName;
5956
- clientSocket.on(channelName, (eventOrMessage)=>{
5957
- receptionEntryPoint.execute(eventOrMessage, clientSocket);
5958
- });
5959
- });
5960
5964
  }
5961
5965
 
5962
5966
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.503",
3
+ "version": "0.0.504",
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)",