@futdevpro/nts-dynamo 1.6.37 → 1.6.39

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.
Files changed (33) hide show
  1. package/lib/_constants/global-settings.const.js +1 -1
  2. package/lib/_constants/global-settings.const.js.map +1 -1
  3. package/lib/_constants/mocks/app-server.mock.d.ts.map +1 -1
  4. package/lib/_constants/mocks/app-server.mock.js.map +1 -1
  5. package/lib/_constants/mocks/socket-client.mock.d.ts.map +1 -1
  6. package/lib/_constants/mocks/socket-client.mock.js +1 -0
  7. package/lib/_constants/mocks/socket-client.mock.js.map +1 -1
  8. package/lib/_models/control-models/socket-event.control-model.d.ts +32 -3
  9. package/lib/_models/control-models/socket-event.control-model.d.ts.map +1 -1
  10. package/lib/_models/control-models/socket-event.control-model.js +26 -24
  11. package/lib/_models/control-models/socket-event.control-model.js.map +1 -1
  12. package/lib/_models/interfaces/global-settings.interface.d.ts +1 -1
  13. package/lib/_models/interfaces/global-settings.interface.d.ts.map +1 -1
  14. package/lib/_services/base/db.service.d.ts.map +1 -1
  15. package/lib/_services/base/db.service.js +39 -0
  16. package/lib/_services/base/db.service.js.map +1 -1
  17. package/lib/_services/socket/socket-client.service.d.ts.map +1 -1
  18. package/lib/_services/socket/socket-client.service.js +6 -3
  19. package/lib/_services/socket/socket-client.service.js.map +1 -1
  20. package/lib/_services/socket/socket-server.service.d.ts +1 -1
  21. package/lib/_services/socket/socket-server.service.d.ts.map +1 -1
  22. package/lib/_services/socket/socket-server.service.js +26 -51
  23. package/lib/_services/socket/socket-server.service.js.map +1 -1
  24. package/lib/tsconfig.tsbuildinfo +1 -1
  25. package/package.json +1 -1
  26. package/src/_constants/global-settings.const.ts +1 -1
  27. package/src/_constants/mocks/app-server.mock.ts +0 -1
  28. package/src/_constants/mocks/socket-client.mock.ts +1 -0
  29. package/src/_models/control-models/socket-event.control-model.ts +59 -29
  30. package/src/_models/interfaces/global-settings.interface.ts +1 -1
  31. package/src/_services/base/db.service.ts +39 -0
  32. package/src/_services/socket/socket-client.service.ts +6 -3
  33. package/src/_services/socket/socket-server.service.ts +28 -57
@@ -13,7 +13,6 @@ import { DynamoNTS_RoutingModule } from '../../_services/route/routing-module.se
13
13
  import { DynamoNTS_App } from '../../_services/server/app.server';
14
14
  import { DynamoNTS_Controller_Mock } from './controller.mock';
15
15
  import { AuthService_Mock } from './auth-service.mock';
16
- import { dynamoNTS_globalSettings } from '../global-settings.const';
17
16
  import { dependency_mock_DataParams, dependent_mock_DataParams } from './data-model.mock';
18
17
  import { getCustomDataRoutingModule } from '../../_modules/custom-data';
19
18
 
@@ -17,6 +17,7 @@ export class SocketClient_Mock extends DynamoNTS_SocketClientService {
17
17
  getIncomingEvents(): DynamoNTS_SocketEvent<any>[] {
18
18
  return [
19
19
  new DynamoNTS_SocketEvent({
20
+ name: 'connect',
20
21
  eventType: DynamoNTS_SocketEventType.connect,
21
22
  tasks: [
22
23
  async (content: any, issuer: string) => {
@@ -21,10 +21,39 @@ export class DynamoNTS_SocketEvent<T>{
21
21
  logEventContent?: boolean;
22
22
 
23
23
  constructor(
24
- set: DynamoNTS_SocketEvent<T>
24
+ set: {
25
+ /**
26
+ * naming the socket will help to follow events on service
27
+ */
28
+ name: string,
29
+ /**
30
+ * define socket event type such as;
31
+ * connection, connect, disconnect, message, error, or anything else
32
+ */
33
+ eventType: DynamoNTS_SocketEventType | string,
34
+ /**
35
+ * preprocesses are the functions the service needs to run before the actual function,
36
+ * these can be used for authentications, or translating data
37
+ *
38
+ * the last function in the array should return the content in the type(T) of the socket<T>
39
+ */
40
+ preProcessess?: DynamoNTS_SocketEventPreprocessTask<any, any>[],
41
+ /**
42
+ * tasks are the functions the service needs to run
43
+ */
44
+ tasks?: DynamoNTS_SocketEventTask<T>[],
45
+ /**
46
+ * logEvent will create a log for the event triggered
47
+ */
48
+ logEvent?: boolean,
49
+ /**
50
+ * logEventContent will create a log for the event triggered with the content
51
+ */
52
+ logEventContent?: boolean,
53
+ }
25
54
  ) {
26
55
  try {
27
- this.socketName = set.socketName;
56
+ this.socketName = set.name;
28
57
  this.eventType = set.eventType;
29
58
 
30
59
  this.preProcessess = set.preProcessess ?? [];
@@ -32,16 +61,25 @@ export class DynamoNTS_SocketEvent<T>{
32
61
 
33
62
  if (set.logEvent !== undefined) {
34
63
  this.logEvent = set.logEvent;
35
- } else if (([ DynamoNTS_SocketEventType.connection, DynamoNTS_SocketEventType.connect, DynamoNTS_SocketEventType.disconnect ] as string[]).includes(this.eventType)) {
36
- this.logEvent = dynamoNTS_globalSettings.logMainSocketEvent;
64
+ } else if (this.eventType === DynamoNTS_SocketEventType.subscribe) {
65
+ this.logEvent = false;
66
+ } else if (
67
+ ([
68
+ DynamoNTS_SocketEventType.connection,
69
+ DynamoNTS_SocketEventType.connect,
70
+ /* DynamoNTS_SocketEventType.subscribe, */
71
+ DynamoNTS_SocketEventType.disconnect,
72
+ ] as string[]).includes(this.eventType)
73
+ ) {
74
+ this.logEvent = dynamoNTS_globalSettings.logMainSocketEvents || dynamoNTS_globalSettings.logAllSocketEvent;
37
75
  } else {
38
76
  this.logEvent = dynamoNTS_globalSettings.logAllSocketEvent;
39
77
  }
40
78
  this.logEventContent = set.logEventContent !== undefined ? set.logEventContent : dynamoNTS_globalSettings.logSocketEventContent;
41
79
 
42
- if (this.logEvent) {
80
+ /* if (this.logEvent) {
43
81
  this.preProcessess.unshift(this.getPreLog());
44
- }
82
+ } */
45
83
  } catch (error) {
46
84
  Dynamo_Log.error(
47
85
  `\nSocket Event params setup failed (${this.socketName}): ${set.eventType}`, error);
@@ -53,45 +91,37 @@ export class DynamoNTS_SocketEvent<T>{
53
91
  *
54
92
  * @returns
55
93
  */
56
- getPreLog?(): DynamoNTS_SocketEventPreprocessTask {
57
- return async (content: T, issuer?: string) => {
58
- try {
59
- if (this.logEvent) {
60
- if (this.logEventContent) {
61
- console.log(`\n==> incoming ${this.socketName} socket event: ${this.eventType} content:`, content);
62
- } else {
63
- console.log(`\n==> incoming ${this.socketName} socket event: ${this.eventType}...`);
64
- }
65
- }
66
-
67
- return content;
68
- } catch (error) {
69
- console.error(`PreLog failed... (socket: ${this.socketName})`, error);
94
+ private async getPreLog(content: T, issuer?: string): Promise<void> {
95
+ try {
96
+ if (this.logEventContent && this.eventType !== DynamoNTS_SocketEventType.connection) {
97
+ Dynamo_Log.log(`--> incoming socket(${this.socketName}) event: ${this.eventType}; content:`, content);
98
+ } else {
99
+ Dynamo_Log.log(`--> incoming socket(${this.socketName}) event: ${this.eventType}...`);
70
100
  }
71
- };
101
+ } catch (error) {
102
+ Dynamo_Log.error(`PreLog failed... (socket: ${this.socketName})`, error);
103
+ }
72
104
  }
73
105
 
74
106
  /**
75
107
  *
76
108
  * @returns
77
109
  */
78
- async executeEventTasks?(content?: T, issuer?: string): Promise<void> {
110
+ async executeEventTasks(content?: T, issuer?: string): Promise<void> {
79
111
  try {
112
+ if (this.logEvent || this.logEventContent) {
113
+ await this.getPreLog(content, issuer);
114
+ }
115
+
80
116
  await Dynamo_Array.asyncForEach(this.preProcessess, async (preProcess: DynamoNTS_SocketEventPreprocessTask<any, any>) => {
81
117
  content = await preProcess(content);
82
118
  });
83
- /* for (let i = 0; i < this.preProcessess.length; i++) {
84
- content = await this.preProcessess[i](content);
85
- } */
86
119
 
87
120
  await Dynamo_Array.asyncForEach(this.tasks, async (task: DynamoNTS_SocketEventTask<T>) => {
88
121
  await task(content, issuer);
89
122
  });
90
- /* for (let i = 0; i < this.tasks.length; i++) {
91
- await this.tasks[i](content, issuer);
92
- } */
93
123
  } catch (error) {
94
- console.error(`Socket Event tasks failed to execute on ${this.socketName}.... (${this.eventType})`, error, 'content:', content);
124
+ Dynamo_Log.error(`Socket Event tasks failed to execute on ${this.socketName}.... (${this.eventType})`, error, 'content:', content);
95
125
  }
96
126
  }
97
127
  }
@@ -45,7 +45,7 @@ export interface DynamoNTS_GlobalSettings {
45
45
  /**
46
46
  * this is an application wide default setting for socket debug logs
47
47
  */
48
- logMainSocketEvent?: boolean;
48
+ logMainSocketEvents?: boolean;
49
49
  /**
50
50
  * this is an application wide default setting for socket debug logs
51
51
  */
@@ -101,6 +101,9 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
101
101
 
102
102
  if (typeof newData._id !== 'string' || typeof newData._id === 'object') {
103
103
  newData._id = `${newData._id}`;
104
+ if (typeof data._id !== 'string' || typeof data._id === 'object') {
105
+ Dynamo_Log.error('data._id stringifying failed! Please notfiy the developer! (DynamoNTS_DBService.findOne)')
106
+ }
104
107
  }
105
108
  data._id = newData._id;
106
109
  data.__v = newData.__v;
@@ -145,6 +148,9 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
145
148
 
146
149
  if (typeof newData._id !== 'string' || typeof newData._id === 'object') {
147
150
  newData._id = `${newData._id}`;
151
+ if (typeof data._id !== 'string' || typeof data._id === 'object') {
152
+ Dynamo_Log.error('data._id stringifying failed! Please notfiy the developer! (DynamoNTS_DBService.findOne)')
153
+ }
148
154
  }
149
155
  data._id = newData._id;
150
156
  data.__v = newData.__v;
@@ -171,6 +177,9 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
171
177
 
172
178
  if (data && (typeof data._id !== 'string' || typeof data._id === 'object')) {
173
179
  data._id = `${data._id}`;
180
+ if (typeof data._id !== 'string' || typeof data._id === 'object') {
181
+ Dynamo_Log.error('data._id stringifying failed! Please notfiy the developer! (DynamoNTS_DBService.findOne)')
182
+ }
174
183
  }
175
184
  return data;
176
185
  }
@@ -208,6 +217,9 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
208
217
 
209
218
  if (data && (typeof data._id !== 'string' || typeof data._id === 'object')) {
210
219
  data._id = `${data._id}`;
220
+ if (typeof data._id !== 'string' || typeof data._id === 'object') {
221
+ Dynamo_Log.error('data._id stringifying failed! Please notfiy the developer! (DynamoNTS_DBService.findOne)')
222
+ }
211
223
  }
212
224
  return data;
213
225
  }
@@ -247,6 +259,9 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
247
259
  dataList.forEach((data: T) => {
248
260
  if (data && (typeof data._id !== 'string' || typeof data._id === 'object')) {
249
261
  data._id = `${data._id}`;
262
+ if (typeof data._id !== 'string' || typeof data._id === 'object') {
263
+ Dynamo_Log.error('data._id stringifying failed! Please notfiy the developer! (DynamoNTS_DBService.findOne)')
264
+ }
250
265
  }
251
266
  });
252
267
  }
@@ -289,6 +304,9 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
289
304
  dataList.forEach((data: T) => {
290
305
  if (data && (typeof data._id !== 'string' || typeof data._id === 'object')) {
291
306
  data._id = `${data._id}`;
307
+ if (typeof data._id !== 'string' || typeof data._id === 'object') {
308
+ Dynamo_Log.error('data._id stringifying failed! Please notfiy the developer! (DynamoNTS_DBService.findOne)')
309
+ }
292
310
  }
293
311
  });
294
312
  }
@@ -319,6 +337,9 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
319
337
  dataList.forEach((data: T) => {
320
338
  if (data && (typeof data._id !== 'string' || typeof data._id === 'object')) {
321
339
  data._id = `${data._id}`;
340
+ if (typeof data._id !== 'string' || typeof data._id === 'object') {
341
+ Dynamo_Log.error('data._id stringifying failed! Please notfiy the developer! (DynamoNTS_DBService.findOne)')
342
+ }
322
343
  }
323
344
  });
324
345
  }
@@ -457,6 +478,9 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
457
478
  dataList.forEach((data: T) => {
458
479
  if (data && (typeof data._id !== 'string' || typeof data._id === 'object')) {
459
480
  data._id = `${data._id}`;
481
+ if (typeof data._id !== 'string' || typeof data._id === 'object') {
482
+ Dynamo_Log.error('data._id stringifying failed! Please notfiy the developer! (DynamoNTS_DBService.findOne)')
483
+ }
460
484
  }
461
485
  });
462
486
  }
@@ -509,6 +533,12 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
509
533
 
510
534
  if (data && (typeof data._id !== 'string' || typeof data._id === 'object')) {
511
535
  data._id = `${data._id}`;
536
+ if (typeof data._id !== 'string' || typeof data._id === 'object') {
537
+ data = JSON.parse(JSON.stringify(data));
538
+ if (typeof data._id !== 'string' || typeof data._id === 'object') {
539
+ Dynamo_Log.error('data._id stringifying failed! Please notfiy the developer! (DynamoNTS_DBService.findOne)')
540
+ }
541
+ }
512
542
  }
513
543
 
514
544
  return data;
@@ -558,6 +588,9 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
558
588
  dataList.forEach((data: T) => {
559
589
  if (data && (typeof data._id !== 'string' || typeof data._id === 'object')) {
560
590
  data._id = `${data._id}`;
591
+ if (typeof data._id !== 'string' || typeof data._id === 'object') {
592
+ Dynamo_Log.error('data._id stringifying failed! Please notfiy the developer! (DynamoNTS_DBService.findOne)')
593
+ }
561
594
  }
562
595
  });
563
596
  }
@@ -617,6 +650,9 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
617
650
  dataList.forEach((data: T) => {
618
651
  if (data && (typeof data._id !== 'string' || typeof data._id === 'object')) {
619
652
  data._id = `${data._id}`;
653
+ if (typeof data._id !== 'string' || typeof data._id === 'object') {
654
+ Dynamo_Log.error('data._id stringifying failed! Please notfiy the developer! (DynamoNTS_DBService.findOne)')
655
+ }
620
656
  }
621
657
  });
622
658
  }
@@ -651,6 +687,9 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
651
687
 
652
688
  if (typeof newData._id !== 'string' || typeof newData._id === 'object') {
653
689
  newData._id = `${newData._id}`;
690
+ if (typeof newData._id !== 'string' || typeof newData._id === 'object') {
691
+ Dynamo_Log.error('newData._id stringifying failed! Please notfiy the developer! (DynamoNTS_DBService.findOne)')
692
+ }
654
693
  }
655
694
 
656
695
  return newData;
@@ -29,6 +29,7 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
29
29
 
30
30
  private defaultEvents: DynamoNTS_SocketEvent<any>[] = [
31
31
  new DynamoNTS_SocketEvent<any>({
32
+ name: 'connect',
32
33
  eventType: DynamoNTS_SocketEventType.connect,
33
34
  tasks: [
34
35
  async () => {
@@ -38,6 +39,7 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
38
39
  ]
39
40
  }),
40
41
  new DynamoNTS_SocketEvent<any>({
42
+ name: 'disconnect',
41
43
  eventType: DynamoNTS_SocketEventType.disconnect,
42
44
  tasks: [
43
45
  async () => {
@@ -52,6 +54,7 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
52
54
  ]
53
55
  }),
54
56
  new DynamoNTS_SocketEvent<any>({
57
+ name: 'error',
55
58
  eventType: DynamoNTS_SocketEventType.error,
56
59
  tasks: [
57
60
  async (content: any) => {
@@ -79,7 +82,7 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
79
82
 
80
83
  await this.setupSocketEvents();
81
84
 
82
- console.log(`\n${this.params?.name} Socket Client Service setup finished`);
85
+ Dynamo_Log.log(`\n${this.params?.name} Socket Client Service setup finished`);
83
86
 
84
87
  await this.connectSocket();
85
88
  } catch (error) {
@@ -133,7 +136,7 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
133
136
 
134
137
  private async connectSocket(): Promise<void> {
135
138
  try {
136
- console.log(`${this.params.name} Socket Client connecting to ${this.params.address}:${this.params.port} ...`);
139
+ Dynamo_Log.log(`${this.params.name} Socket Client connecting to ${this.params.address}:${this.params.port} ...`);
137
140
 
138
141
  this.socket.connect();
139
142
 
@@ -167,7 +170,7 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
167
170
  */
168
171
  protected async emitEvent(eventType: string, content: any): Promise<void> {
169
172
  try {
170
- console.log(`\n<== outgoing ${this.name} socket event: ${eventType}`);
173
+ Dynamo_Log.log(`\n<-- outgoing ${this.name} socket event: ${eventType}`);
171
174
  this.socket.emit(eventType, content);
172
175
  } catch (error) {
173
176
  Dynamo_Log.error(`Socket Client Service Emit Event failed: ${this.params?.name} (${this.params?.port})`, error);
@@ -93,8 +93,8 @@ export abstract class DynamoNTS_SocketServerService<
93
93
  this.connectEvent = this.incomingEvents.splice(connectEventIndex)[0];
94
94
  } else {
95
95
  this.connectEvent = new DynamoNTS_SocketEvent({
96
+ name: 'connect',
96
97
  eventType: DynamoNTS_SocketEventType.connection,
97
- tasks: []
98
98
  });
99
99
  }
100
100
  this.connectEvent.socketName = this.params.name;
@@ -110,6 +110,7 @@ export abstract class DynamoNTS_SocketServerService<
110
110
  );
111
111
  } else {
112
112
  this.subscriptionEvent = new DynamoNTS_SocketEvent<T_SubscriptionContent>({
113
+ name: 'subscribe',
113
114
  eventType: DynamoNTS_SocketEventType.subscribe
114
115
  });
115
116
  }
@@ -126,6 +127,7 @@ export abstract class DynamoNTS_SocketServerService<
126
127
  } else {
127
128
  this.incomingEvents.push(
128
129
  new DynamoNTS_SocketEvent({
130
+ name: 'disconnect',
129
131
  eventType: DynamoNTS_SocketEventType.disconnect,
130
132
  tasks: [
131
133
  this.removeSubscriptionOnDisconnect
@@ -137,6 +139,7 @@ export abstract class DynamoNTS_SocketServerService<
137
139
  const errorEventIndex = this.incomingEvents.findIndex((event: DynamoNTS_SocketEvent<any>) => event.eventType === DynamoNTS_SocketEventType.error);
138
140
  if (errorEventIndex == -1 && this.errorHandling) {
139
141
  this.incomingEvents.push(new DynamoNTS_SocketEvent<T_ErrorContent>({
142
+ name: 'error',
140
143
  eventType: DynamoNTS_SocketEventType.error,
141
144
  tasks: [
142
145
  this.errorHandling
@@ -161,44 +164,25 @@ export abstract class DynamoNTS_SocketServerService<
161
164
  async setupSocketServer(newSocketServer: SocketIO.Server, security: DynamoNTS_SocketSecurity.open | DynamoNTS_SocketSecurity.secure, successCallback: () => void): Promise<SocketIO.Server> {
162
165
  try {
163
166
  if (this.logFn) console.log('\nfn:. setupSocketServer');
164
- /* if (security === DynamoNTS_SocketSecurity.open) {
165
- this.openSocketServer = newSocketServer;
166
- } else {
167
- this.secureSocketServer = newSocketServer;
168
- } */
169
- /* (security === DynamoNTS_SocketSecurity.open ? this.openSocketServer : this.secureSocketServer) */
167
+
170
168
  newSocketServer.on(DynamoNTS_SocketEventType.connection, async (socket: SocketIO.Socket) => {
171
169
  try {
172
170
  let issuer: string;
173
- if (dynamoNTS_globalSettings.logMainSocketEvent) {
174
- console.log(`Socket (${this.params.name}): new incoming CONNECTION...`);
175
- }
176
-
177
- await Dynamo_Array.asyncForEach(this.connectEvent.preProcessess,
178
- async (preProcess: (content: SocketIO.Socket) => Promise<void>) => {
179
- await preProcess(socket);
180
- }
181
- );
182
- /* for (let i = 0; i < this.connectEvent.preProcessess.length; i++) {
183
- await this.connectEvent.preProcessess[i](socket);
184
- } */
185
-
186
- await Dynamo_Array.asyncForEach(this.connectEvent.tasks,
187
- async (task: (content: SocketIO.Socket) => Promise<void>) => {
188
- await task(socket);
189
- }
190
- );
191
- /* for (let i = 0; i < this.connectEvent.tasks.length; i++) {
192
- await this.connectEvent.tasks[i](socket);
193
- } */
171
+
172
+ await this.connectEvent.executeEventTasks(socket);
194
173
 
195
174
  if (this.getPresenceFromSubscrioptionEventContent) {
196
175
  socket.on(DynamoNTS_SocketEventType.subscribe, async (content: any) => {
197
176
  try {
198
- if (dynamoNTS_globalSettings.logMainSocketEvent || dynamoNTS_globalSettings.logAllSocketEvent || dynamoNTS_globalSettings.logSocketEventContent) {
199
- console.log(`---> incoming socket event: ${DynamoNTS_SocketEventType.subscribe} (${this.params.name}, presenceId: ${issuer})`, content);
177
+ /**
178
+ * usually socket logs are in event.executeEventTasks(),
179
+ * but subscribe event is an exception from this,
180
+ * to be able to check content before getPresenceFromSubscrioptionEventContent
181
+ */
182
+ if (dynamoNTS_globalSettings.logMainSocketEvents || dynamoNTS_globalSettings.logAllSocketEvent || dynamoNTS_globalSettings.logSocketEventContent) {
183
+ Dynamo_Log.log(`---> incoming socket(${this.params.name}) event: ${DynamoNTS_SocketEventType.subscribe}; content:`, content);
200
184
  } else {
201
- console.log(`---> incoming socket event: ${DynamoNTS_SocketEventType.subscribe} (${this.params.name}, presenceId: ${issuer})`);
185
+ Dynamo_Log.log(`---> incoming socket(${this.params.name}) event: ${DynamoNTS_SocketEventType.subscribe}`);
202
186
  }
203
187
 
204
188
  const presence: T_Presence = await this.getPresenceFromSubscrioptionEventContent(content, socket);
@@ -219,12 +203,6 @@ export abstract class DynamoNTS_SocketServerService<
219
203
  this.incomingEvents.forEach((event: DynamoNTS_SocketEvent<any>) => {
220
204
  socket.on(event.eventType, async (content: any) => {
221
205
  try {
222
- if (dynamoNTS_globalSettings.logAllSocketEvent || dynamoNTS_globalSettings.logSocketEventContent) {
223
- console.log(`---> incoming socket event: ${event.eventType} (${this.params.name}, presenceId: ${issuer})`, content);
224
- } else {
225
- console.log(`---> incoming socket event: ${event.eventType} (${this.params.name}, presenceId: ${issuer})`);
226
- }
227
-
228
206
  await event.executeEventTasks(content, issuer);
229
207
  } catch (error) {
230
208
  Dynamo_Log.error(`Socket Event failed: ${this.params.name} (${this.params.port})`, error);
@@ -233,7 +211,7 @@ export abstract class DynamoNTS_SocketServerService<
233
211
  });
234
212
  });
235
213
 
236
- if (dynamoNTS_globalSettings.logMainSocketEvent) {
214
+ if (dynamoNTS_globalSettings.logMainSocketEvents) {
237
215
  console.log(`Socket (${this.params.name}): new CONNECTION established`);
238
216
  }
239
217
  } catch (error) {
@@ -244,13 +222,6 @@ export abstract class DynamoNTS_SocketServerService<
244
222
  });
245
223
 
246
224
  newSocketServer.listen(this.params.port);
247
- /* if (security === DynamoNTS_SocketSecurity.open) {
248
- this.openSocketServer = newSocketServer;
249
- this.openSocketServer.listen(this.params.port);
250
- } else {
251
- this.secureSocketServer = newSocketServer;
252
- this.secureSocketServer.listen(this.params.port);
253
- } */
254
225
 
255
226
  Dynamo_Log.success(
256
227
  `\nsocket server setup finished: ${this.params.name}` +
@@ -320,7 +291,7 @@ export abstract class DynamoNTS_SocketServerService<
320
291
 
321
292
  emitEvent(event: string, content: any): void {
322
293
  try {
323
- console.log(` <--- emitting socket event: ${event} (${this.params.name})`);
294
+ Dynamo_Log.log(` <--- emitting socket event: ${event} (${this.params.name})`);
324
295
  this.openSocketServer.emit(event, content);
325
296
  } catch (error) {
326
297
  Dynamo_Log.error(`Socket Event Emit (${event}) failed: ${this.params?.name} (${this.params?.port})`, error);
@@ -346,22 +317,22 @@ export abstract class DynamoNTS_SocketServerService<
346
317
  }
347
318
  }
348
319
 
349
- async sendEventForId(id: string, event: string, content: any, error?: (err: any) => void): Promise<void> {
320
+ async sendEventForId(id: string, event: string, content: any/* , error?: (err: any) => void */): Promise<void> {
350
321
  try {
351
322
  const presence: DynamoNTS_SocketPresence = this.presences.find((pres: DynamoNTS_SocketPresence) => pres.issuerId === id);
352
323
  if (presence) {
353
- console.log(` <--- emitting socket event for presence: ${event} (${this.params.name}, presenceId: ${id})`);
324
+ Dynamo_Log.log(` <--- emitting socket event for presence: ${event} (${this.params.name}, presenceId: ${id})`);
354
325
  presence.emitEvent(event, content);
355
326
  } else {
356
- if (error) {
357
- throw new Dynamo_Error({
358
- status: 404,
359
- errorCode: 'NTS-S99-001',
360
- addECToUserMsg: true,
361
- message: `No active socket whit this specific ID: ${id}`,
362
- userMessage: this.defaultErrorUserMsg
363
- });
364
- }
327
+ /* if (error) { */
328
+ throw new Dynamo_Error({
329
+ status: 404,
330
+ errorCode: 'NTS-S99-001',
331
+ addECToUserMsg: true,
332
+ message: `No active socket whit this specific ID: ${id}`,
333
+ userMessage: this.defaultErrorUserMsg
334
+ });
335
+ /* } */
365
336
  }
366
337
  } catch (error) {
367
338
  Dynamo_Log.error(`Socket Event Emit for id (${id}, ${event}) failed: ${this.params?.name} (${this.params?.port})`, error);