@futdevpro/nts-dynamo 1.6.22 → 1.6.24
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.
- package/lib/_constants/mocks/app-extended-server.mock.js +2 -2
- package/lib/_constants/mocks/app-server.mock.js +1 -1
- package/lib/_services/server/app-extended.server.d.ts.map +1 -1
- package/lib/_services/server/app-extended.server.js +31 -3
- package/lib/_services/server/app-extended.server.js.map +1 -1
- package/lib/_services/server/app.server.d.ts +1 -1
- package/lib/_services/server/app.server.d.ts.map +1 -1
- package/lib/_services/server/app.server.js +28 -7
- package/lib/_services/server/app.server.js.map +1 -1
- package/lib/_services/socket/socket-client.service.d.ts +4 -2
- package/lib/_services/socket/socket-client.service.d.ts.map +1 -1
- package/lib/_services/socket/socket-client.service.js +93 -65
- package/lib/_services/socket/socket-client.service.js.map +1 -1
- package/lib/_services/socket/socket-server.service.d.ts +1 -0
- package/lib/_services/socket/socket-server.service.d.ts.map +1 -1
- package/lib/_services/socket/socket-server.service.js +82 -66
- package/lib/_services/socket/socket-server.service.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/_constants/mocks/app-extended-server.mock.ts +4 -3
- package/src/_constants/mocks/app-server.mock.ts +1 -1
- package/src/_services/server/app-extended.server.ts +29 -3
- package/src/_services/server/app.server.ts +29 -10
- package/src/_services/socket/socket-client.service.ts +32 -16
- package/src/_services/socket/socket-server.service.ts +15 -3
|
@@ -104,7 +104,7 @@ export class DynamoNTS_AppExtendedFull_Mock extends DynamoNTS_AppExtended {
|
|
|
104
104
|
}),
|
|
105
105
|
|
|
106
106
|
getTestRoutingModule(),
|
|
107
|
-
getUsageRoutingModule()
|
|
107
|
+
getUsageRoutingModule(),
|
|
108
108
|
];
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -173,7 +173,7 @@ export class DynamoNTS_AppWbMock_Mock extends DynamoNTS_AppExtended {
|
|
|
173
173
|
}),
|
|
174
174
|
|
|
175
175
|
getTestRoutingModule(),
|
|
176
|
-
getUsageRoutingModule()
|
|
176
|
+
getUsageRoutingModule(),
|
|
177
177
|
];
|
|
178
178
|
}
|
|
179
179
|
|
|
@@ -188,4 +188,5 @@ export class DynamoNTS_AppWbMock_Mock extends DynamoNTS_AppExtended {
|
|
|
188
188
|
SocketClient_Mock.getInstance(),
|
|
189
189
|
];
|
|
190
190
|
}
|
|
191
|
-
}
|
|
191
|
+
}
|
|
192
|
+
|
|
@@ -136,7 +136,9 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
136
136
|
constructor(){
|
|
137
137
|
super(true);
|
|
138
138
|
|
|
139
|
-
this.asyncConstructExt()
|
|
139
|
+
this.asyncConstructExt().catch((error: any) => {
|
|
140
|
+
Dynamo_Log.error(`\nExtended Application: ${this.params?.name} start failed.\n`, error, '\n');
|
|
141
|
+
});
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
private async asyncConstructExt(): Promise<void> {
|
|
@@ -163,6 +165,24 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
163
165
|
Dynamo_Log.test(`${this.params.name} started successfully.`);
|
|
164
166
|
} catch (error) {
|
|
165
167
|
Dynamo_Log.error(`\nExtended Application: ${this.params?.name} start failed.\n`, error, '\n');
|
|
168
|
+
throw new Dynamo_Error({
|
|
169
|
+
errorCode: 'NTS-AES-001',
|
|
170
|
+
error: error,
|
|
171
|
+
additionalContent: {
|
|
172
|
+
constructErrors: this.constructErrors,
|
|
173
|
+
systemControls: this.systemControls,
|
|
174
|
+
systemControlsExt: this.systemControlsExt,
|
|
175
|
+
systemReadies: {
|
|
176
|
+
app: this.systemControls.app.getReady(),
|
|
177
|
+
appExtended: this.systemControlsExt.appExtended.getReady(),
|
|
178
|
+
mongoose: this.systemControls.mongoose.getReady(),
|
|
179
|
+
httpServer: this.systemControls.httpServer.getReady(),
|
|
180
|
+
httpsServer: this.systemControls.httpsServer.getReady(),
|
|
181
|
+
httpSocketServer: this.systemControlsExt.httpSocketServer.getReady(),
|
|
182
|
+
httpsSocketServer: this.systemControlsExt.httpsSocketServer.getReady(),
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
});
|
|
166
186
|
}
|
|
167
187
|
}
|
|
168
188
|
|
|
@@ -189,9 +209,13 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
189
209
|
this.systemControlsExt.httpSocketServer.getReady() &&
|
|
190
210
|
this.systemControlsExt.httpsSocketServer.getReady()
|
|
191
211
|
);
|
|
212
|
+
} else {
|
|
213
|
+
Dynamo_Log.error(`${this.params.name} APP NOT INITIALIZED while trying to get ready.`);
|
|
192
214
|
}
|
|
193
215
|
|
|
194
|
-
|
|
216
|
+
if (!ready) {
|
|
217
|
+
await wait(100);
|
|
218
|
+
}
|
|
195
219
|
}
|
|
196
220
|
|
|
197
221
|
if (this.constructErrors.length) {
|
|
@@ -325,13 +349,13 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
325
349
|
errorMsg += `\n ${service?.name} (port: ${service.port})`;
|
|
326
350
|
}
|
|
327
351
|
});
|
|
328
|
-
Dynamo_Log.error(errorMsg);
|
|
329
352
|
|
|
330
353
|
let error = new Error('Secure routes cannot be established!');
|
|
331
354
|
let errorStack: string[] = error.stack.split('\n');
|
|
332
355
|
errorStack.splice(1, 2);
|
|
333
356
|
error.stack = errorStack.join('\n');
|
|
334
357
|
|
|
358
|
+
Dynamo_Log.error(errorMsg);
|
|
335
359
|
throw error;
|
|
336
360
|
}
|
|
337
361
|
}
|
|
@@ -352,6 +376,7 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
352
376
|
errorStack.splice(1, 4);
|
|
353
377
|
error.stack = errorStack.join('\n');
|
|
354
378
|
|
|
379
|
+
Dynamo_Log.error(`\n${error.message}`);
|
|
355
380
|
throw error;
|
|
356
381
|
}
|
|
357
382
|
|
|
@@ -397,6 +422,7 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
397
422
|
errorStack.splice(1, 4);
|
|
398
423
|
error.stack = errorStack.join('\n');
|
|
399
424
|
|
|
425
|
+
Dynamo_Log.error(`\n${error.message}`);
|
|
400
426
|
throw error;
|
|
401
427
|
}
|
|
402
428
|
} catch (error) {
|
|
@@ -208,11 +208,9 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
208
208
|
protected httpServer: Http.Server;
|
|
209
209
|
|
|
210
210
|
private globalService: DynamoNTS_GlobalService;
|
|
211
|
+
private _rootServices: DynamoNTS_SingletonService[] = [];
|
|
211
212
|
|
|
212
213
|
private _routingModules: DynamoNTS_RoutingModule[] = [];
|
|
213
|
-
/* protected get routingModules(): DynamoNTS_RoutingModule[] { return this._routingModules; } */
|
|
214
|
-
|
|
215
|
-
private _rootServices: DynamoNTS_SingletonService[] = [];
|
|
216
214
|
|
|
217
215
|
/**
|
|
218
216
|
* setting this value to true, enables this service debug logs
|
|
@@ -224,7 +222,9 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
224
222
|
constructor(extended?: boolean){
|
|
225
223
|
super();
|
|
226
224
|
|
|
227
|
-
this.asyncConstruct(extended)
|
|
225
|
+
this.asyncConstruct(extended).catch((error: any) => {
|
|
226
|
+
Dynamo_Log.error(`\nApplication: ${this._params.name} start failed.\n`, error);
|
|
227
|
+
});
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
private async asyncConstruct(extended?: boolean): Promise<void> {
|
|
@@ -301,7 +301,21 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
301
301
|
}
|
|
302
302
|
} catch (error) {
|
|
303
303
|
this.constructErrors.push(error);
|
|
304
|
-
Dynamo_Log.error(
|
|
304
|
+
Dynamo_Log.error(`${this._params.name} start failed. ERRORS`, this.constructErrors);
|
|
305
|
+
throw new Dynamo_Error({
|
|
306
|
+
errorCode: 'NTS-AS0-001',
|
|
307
|
+
error: error,
|
|
308
|
+
additionalContent: {
|
|
309
|
+
constructErrors: this.constructErrors,
|
|
310
|
+
systemControls: this.systemControls,
|
|
311
|
+
systemReadies: {
|
|
312
|
+
app: this.systemControls.app.getReady(),
|
|
313
|
+
mongoose: this.systemControls.mongoose.getReady(),
|
|
314
|
+
httpServer: this.systemControls.httpServer.getReady(),
|
|
315
|
+
httpsServer: this.systemControls.httpsServer.getReady(),
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
});
|
|
305
319
|
}
|
|
306
320
|
}
|
|
307
321
|
|
|
@@ -325,14 +339,18 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
325
339
|
this.systemControls.httpServer.getReady() &&
|
|
326
340
|
this.systemControls.httpsServer.getReady()
|
|
327
341
|
);
|
|
342
|
+
} else {
|
|
343
|
+
Dynamo_Log.error(`${this.params.name} APP NOT INITIALIZED while trying to get ready.`);
|
|
328
344
|
}
|
|
329
345
|
|
|
330
|
-
|
|
346
|
+
if (!ready) {
|
|
347
|
+
await wait(100);
|
|
348
|
+
}
|
|
331
349
|
}
|
|
332
350
|
|
|
333
351
|
if (timeout < +new Date() - start) {
|
|
334
352
|
Dynamo_Log.error(`${this._params.name} start failed. TIMEOUT`, this.constructErrors);
|
|
335
|
-
throw new Dynamo_Error({
|
|
353
|
+
throw new Dynamo_Error({
|
|
336
354
|
message: `${this._params.name} start failed. TIMEOUT`,
|
|
337
355
|
additionalContent: {
|
|
338
356
|
constructErrors: this.constructErrors,
|
|
@@ -348,7 +366,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
348
366
|
|
|
349
367
|
if (this.constructErrors.length) {
|
|
350
368
|
Dynamo_Log.error(`${this._params.name} start failed. ERROR`, this.constructErrors);
|
|
351
|
-
throw new Dynamo_Error({
|
|
369
|
+
throw new Dynamo_Error({
|
|
352
370
|
message: `${this._params.name} start failed. ERROR`,
|
|
353
371
|
additionalContent: this.constructErrors,
|
|
354
372
|
});
|
|
@@ -500,13 +518,13 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
500
518
|
});
|
|
501
519
|
}
|
|
502
520
|
});
|
|
503
|
-
Dynamo_Log.error(errorMsg);
|
|
504
521
|
|
|
505
522
|
let error = new Error('Open routes cannot be established!');
|
|
506
523
|
let errorStack: string[] = error.stack.split('\n');
|
|
507
524
|
errorStack.splice(1, 2);
|
|
508
525
|
error.stack = errorStack.join('\n');
|
|
509
526
|
|
|
527
|
+
Dynamo_Log.error(errorMsg);
|
|
510
528
|
throw error;
|
|
511
529
|
}
|
|
512
530
|
|
|
@@ -537,13 +555,13 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
537
555
|
});
|
|
538
556
|
}
|
|
539
557
|
});
|
|
540
|
-
Dynamo_Log.error(errorMsg);
|
|
541
558
|
|
|
542
559
|
let error = new Error('Secure routes cannot be established!');
|
|
543
560
|
let errorStack: string[] = error.stack.split('\n');
|
|
544
561
|
errorStack.splice(1, 2);
|
|
545
562
|
error.stack = errorStack.join('\n');
|
|
546
563
|
|
|
564
|
+
Dynamo_Log.error(errorMsg);
|
|
547
565
|
throw error;
|
|
548
566
|
}
|
|
549
567
|
|
|
@@ -653,6 +671,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
653
671
|
}
|
|
654
672
|
} catch (error) {
|
|
655
673
|
Dynamo_Log.error(`startExpresses failed...`, error);
|
|
674
|
+
throw error;
|
|
656
675
|
}
|
|
657
676
|
}
|
|
658
677
|
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import * as SocketIO from 'socket.io-client';
|
|
5
5
|
|
|
6
6
|
import { DynamoNTS_SingletonService } from '../base/singleton.service';
|
|
7
|
-
import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
8
|
-
import { delay } from '@futdevpro/fsm-dynamo/utils';
|
|
7
|
+
import { Dynamo_Error, Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
8
|
+
import { delay, Dynamo_Array } from '@futdevpro/fsm-dynamo/utils';
|
|
9
9
|
import { DynamoNTS_SocketClientServiceParams } from '../../_models/control-models/socket-client-service-params.control-model';
|
|
10
10
|
import { dynamoNTS_globalSettings } from '../../_constants/global-settings.const';
|
|
11
11
|
import { DynamoNTS_SocketEvent } from '../../_models/control-models/socket-event.control-model';
|
|
@@ -17,8 +17,6 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
17
17
|
protected get params(): DynamoNTS_SocketClientServiceParams { return this._params; }
|
|
18
18
|
get name(): string { return this.params.name; }
|
|
19
19
|
|
|
20
|
-
protected log: boolean = dynamoNTS_globalSettings.logSetup;
|
|
21
|
-
|
|
22
20
|
protected socket: SocketIO.Socket
|
|
23
21
|
|
|
24
22
|
protected incomingEvents: DynamoNTS_SocketEvent<any>[];
|
|
@@ -26,6 +24,9 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
26
24
|
protected _connected: boolean = false;
|
|
27
25
|
get connected(): boolean { return this._connected; }
|
|
28
26
|
|
|
27
|
+
protected log: boolean = dynamoNTS_globalSettings.logSetup;
|
|
28
|
+
protected logFn: boolean;
|
|
29
|
+
|
|
29
30
|
private defaultEvents: DynamoNTS_SocketEvent<any>[] = [
|
|
30
31
|
new DynamoNTS_SocketEvent<any>({
|
|
31
32
|
eventType: DynamoNTS_SocketEventType.connect,
|
|
@@ -60,29 +61,39 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
60
61
|
}),
|
|
61
62
|
];
|
|
62
63
|
|
|
63
|
-
|
|
64
64
|
protected constructor() {
|
|
65
65
|
super();
|
|
66
66
|
|
|
67
|
+
this.asyncConstructor().catch((error: any) => {
|
|
68
|
+
Dynamo_Log.error(`${this.params?.name} Socket Client Service setup failed!`, error);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private async asyncConstructor(): Promise<void> {
|
|
67
73
|
try {
|
|
68
74
|
this._params = this.getParams();
|
|
69
75
|
this.incomingEvents = this.getIncomingEvents() ?? [];
|
|
70
76
|
this.socket = SocketIO.io(`${this.params.address}:${this.params.port}`/* , this._params.socketOptions */);
|
|
71
77
|
|
|
72
|
-
this.setupDefaultEvents();
|
|
78
|
+
await this.setupDefaultEvents();
|
|
73
79
|
|
|
74
|
-
this.setupSocketEvents();
|
|
80
|
+
await this.setupSocketEvents();
|
|
75
81
|
|
|
76
82
|
console.log(`\n${this.params?.name} Socket Client Service setup finished`);
|
|
77
83
|
|
|
78
|
-
this.connectSocket();
|
|
84
|
+
await this.connectSocket();
|
|
79
85
|
} catch (error) {
|
|
80
86
|
Dynamo_Log.error(`${this.params?.name} Socket Client Service setup failed!`, error);
|
|
87
|
+
throw new Dynamo_Error({
|
|
88
|
+
errorCode: 'NTS-SCS-001',
|
|
89
|
+
error: error,
|
|
90
|
+
});
|
|
81
91
|
}
|
|
82
92
|
}
|
|
83
93
|
|
|
84
|
-
private setupDefaultEvents(): void {
|
|
94
|
+
private async setupDefaultEvents(): Promise<void> {
|
|
85
95
|
try {
|
|
96
|
+
if (this.logFn) console.log('\nFn:. setupDefaultEvents')
|
|
86
97
|
this.defaultEvents.forEach((defaultEvent: DynamoNTS_SocketEvent<any>) => {
|
|
87
98
|
const eventDeclared = this.incomingEvents.find((event: DynamoNTS_SocketEvent<any>) => event.eventType === defaultEvent.eventType);
|
|
88
99
|
if (!eventDeclared) {
|
|
@@ -93,14 +104,15 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
93
104
|
});
|
|
94
105
|
} catch (error) {
|
|
95
106
|
Dynamo_Log.error(`Socket Client Service Setup Default Events failed: ${this.params?.name} (${this.params?.port})`, error);
|
|
107
|
+
throw error;
|
|
96
108
|
}
|
|
97
109
|
}
|
|
98
110
|
|
|
99
|
-
private setupSocketEvents(): void {
|
|
111
|
+
private async setupSocketEvents(): Promise<void> {
|
|
100
112
|
try {
|
|
101
113
|
if (this.log) console.log(`Setup Socket Events... (${this.params.name})`);
|
|
102
114
|
|
|
103
|
-
this.incomingEvents
|
|
115
|
+
await Dynamo_Array.asyncForEach(this.incomingEvents, async (event: DynamoNTS_SocketEvent<any>) => {
|
|
104
116
|
if (!event.socketName) {
|
|
105
117
|
event.socketName = this.name;
|
|
106
118
|
}
|
|
@@ -109,38 +121,42 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
109
121
|
await event.executeEventTasks(content, this.params.service);
|
|
110
122
|
} catch (error) {
|
|
111
123
|
Dynamo_Log.error(`Socket Event failed: ${this.params.name} (${this.params.port})`, error);
|
|
112
|
-
this.emitEvent(DynamoNTS_SocketEventType.error, error);
|
|
124
|
+
await this.emitEvent(DynamoNTS_SocketEventType.error, error);
|
|
113
125
|
}
|
|
114
126
|
});
|
|
115
127
|
});
|
|
116
128
|
} catch (error) {
|
|
117
129
|
Dynamo_Log.error(`Socket Client Service Setup Socket Events failed: ${this.params?.name} (${this.params?.port})`, error);
|
|
130
|
+
throw error;
|
|
118
131
|
}
|
|
119
132
|
}
|
|
120
133
|
|
|
121
|
-
private connectSocket(): void {
|
|
134
|
+
private async connectSocket(): Promise<void> {
|
|
122
135
|
try {
|
|
123
136
|
console.log(`${this.params.name} Socket Client connecting to ${this.params.address}:${this.params.port} ...`);
|
|
124
137
|
|
|
125
138
|
this.socket.connect();
|
|
126
139
|
|
|
127
140
|
if (this.params.reconnect) {
|
|
128
|
-
this.tryReconnectIfNeeded();
|
|
141
|
+
await this.tryReconnectIfNeeded();
|
|
129
142
|
}
|
|
130
143
|
} catch (error) {
|
|
131
144
|
Dynamo_Log.error(`Socket Client Service Connect Socket failed: ${this.params?.name} (${this.params?.port})`, error);
|
|
145
|
+
throw error;
|
|
132
146
|
}
|
|
133
147
|
}
|
|
134
148
|
|
|
135
149
|
private async tryReconnectIfNeeded(): Promise<void> {
|
|
136
150
|
try {
|
|
151
|
+
if (this.logFn) console.log(`\nFn:. tryReconnectIfNeeded`);
|
|
137
152
|
await delay(this._params.reconnectDelay);
|
|
138
153
|
|
|
139
154
|
if (!this._connected) {
|
|
140
|
-
this.connectSocket();
|
|
155
|
+
await this.connectSocket();
|
|
141
156
|
}
|
|
142
157
|
} catch (error) {
|
|
143
158
|
Dynamo_Log.error(`Socket Client Service Try Reconnect failed: ${this.params?.name} (${this.params?.port})`, error);
|
|
159
|
+
throw error;
|
|
144
160
|
}
|
|
145
161
|
}
|
|
146
162
|
|
|
@@ -149,7 +165,7 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
149
165
|
* @param eventType event name
|
|
150
166
|
* @param content event content
|
|
151
167
|
*/
|
|
152
|
-
protected emitEvent(eventType: string, content: any): void {
|
|
168
|
+
protected async emitEvent(eventType: string, content: any): Promise<void> {
|
|
153
169
|
try {
|
|
154
170
|
console.log(`\n<== outgoing ${this.name} socket event: ${eventType}`);
|
|
155
171
|
this.socket.emit(eventType, content);
|
|
@@ -60,23 +60,33 @@ export abstract class DynamoNTS_SocketServerService<
|
|
|
60
60
|
constructor(){
|
|
61
61
|
super();
|
|
62
62
|
|
|
63
|
+
this.asyncConstructor().catch((error: any) => {
|
|
64
|
+
Dynamo_Log.error(`Socket Server Service setup failed: ${this.params?.name} (${this.params?.port})`, error);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private async asyncConstructor(): Promise<void> {
|
|
63
69
|
try {
|
|
64
70
|
this.logSetup = dynamoNTS_globalSettings.logSetup;
|
|
65
71
|
this.params = this.getServiceParams();
|
|
66
72
|
this.incomingEvents = this.getIncomingEvents() ?? [];
|
|
67
|
-
|
|
68
|
-
this.prepareEvents();
|
|
73
|
+
|
|
74
|
+
await this.prepareEvents();
|
|
69
75
|
|
|
70
76
|
if (this.logSetup) console.log(`Socket Server Service setup done: ${this.params.name} (${this.params.port}) serurity: ${this.params.security}\n`);
|
|
71
77
|
} catch (error) {
|
|
72
78
|
Dynamo_Log.error(`Socket Server Service setup failed: ${this.params?.name} (${this.params?.port})`, error);
|
|
79
|
+
throw new Dynamo_Error({
|
|
80
|
+
errorCode: 'NTS-SSS-001',
|
|
81
|
+
error: error,
|
|
82
|
+
});
|
|
73
83
|
}
|
|
74
84
|
}
|
|
75
85
|
|
|
76
86
|
/**
|
|
77
87
|
* You must setup events and required services for this function
|
|
78
88
|
*/
|
|
79
|
-
private prepareEvents(): void {
|
|
89
|
+
private async prepareEvents(): Promise<void> {
|
|
80
90
|
try {
|
|
81
91
|
const connectEventIndex = this.incomingEvents.findIndex((event: DynamoNTS_SocketEvent<any>) => event.eventType === DynamoNTS_SocketEventType.connection);
|
|
82
92
|
if (0 <= connectEventIndex) {
|
|
@@ -142,6 +152,7 @@ export abstract class DynamoNTS_SocketServerService<
|
|
|
142
152
|
});
|
|
143
153
|
} catch (error) {
|
|
144
154
|
Dynamo_Log.error(`Socket Server Service - Event Preparation setup failed: ${this.params?.name} (${this.params?.port})`, error);
|
|
155
|
+
throw error;
|
|
145
156
|
}
|
|
146
157
|
}
|
|
147
158
|
|
|
@@ -266,6 +277,7 @@ export abstract class DynamoNTS_SocketServerService<
|
|
|
266
277
|
}
|
|
267
278
|
} catch (error) {
|
|
268
279
|
Dynamo_Log.error(`Socket Subscription Removal failed: ${this.params?.name} (${this.params?.port})`, error);
|
|
280
|
+
throw error;
|
|
269
281
|
}
|
|
270
282
|
}
|
|
271
283
|
|