diff --git a/packages/microservice/src/InternalService.ts b/packages/microservice/src/InternalService.ts index e94bd28..12da069 100644 --- a/packages/microservice/src/InternalService.ts +++ b/packages/microservice/src/InternalService.ts @@ -29,7 +29,7 @@ export abstract class InternalService ext /** * The service name */ - public abstract get name(): string; + public abstract readonly NAME: string; /** * Boot the service @@ -61,6 +61,6 @@ export abstract class InternalService ext if (!this.logging) { return; } - console.log(`[${this.name}]:`, ...args); + console.log(`[${this.NAME}]:`, ...args); } } diff --git a/packages/microservice/src/Microservice.ts b/packages/microservice/src/Microservice.ts index a58a9d4..be72d8c 100644 --- a/packages/microservice/src/Microservice.ts +++ b/packages/microservice/src/Microservice.ts @@ -156,7 +156,7 @@ export class Microservice */ public installService(this: T, InternalServiceClass: InternalServiceConstructor) { let InternalService = new InternalServiceClass(this); - this.services[InternalService.name] = InternalService; + this.services[InternalService.NAME] = InternalService; } /** diff --git a/packages/microservice/src/ipc/AbstractIpcService.ts b/packages/microservice/src/ipc/AbstractIpcService.ts index 2b5d490..e48f4e1 100644 --- a/packages/microservice/src/ipc/AbstractIpcService.ts +++ b/packages/microservice/src/ipc/AbstractIpcService.ts @@ -43,7 +43,7 @@ export default abstract class AbstractIpcService ex public bootIpc(ipc: IPC) { // Connect to the server return new Promise((resolve, reject) => { - this.rawIpcInstance!.connectTo(this.name, this.socketPath, () => { + this.rawIpcInstance!.connectTo(this.NAME, this.socketPath, () => { this.__isConnected = true; this.__requestId = 0; - this.__socket = ipc!.of[this.name]; + this.__socket = ipc!.of[this.NAME]; this.installEventHandlers(this.__socket!); this.installMessageHandlers(); resolve(); @@ -74,7 +74,7 @@ export abstract class IpcClientService ex * Shutdown the IPC service */ public async shutdownIpc(ipc: IPC|null) { - ipc?.disconnect(this.name); + ipc?.disconnect(this.NAME); this.__socket?.removeAllListeners(); this.__socket?.destroy(); this.__socket = null;