From b153c0fd46bdc1dc8006e4dac4d4dfa739ff7707 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 14 May 2022 12:14:48 +0200 Subject: [PATCH] Fix UI server options type and instantiation signature MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ui-server/UIServerFactory.ts | 5 ++--- src/charging-station/ui-server/UIWebSocketServer.ts | 4 ++-- src/types/ConfigurationData.ts | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/charging-station/ui-server/UIServerFactory.ts b/src/charging-station/ui-server/UIServerFactory.ts index cdcd251a..1ad64014 100644 --- a/src/charging-station/ui-server/UIServerFactory.ts +++ b/src/charging-station/ui-server/UIServerFactory.ts @@ -11,12 +11,11 @@ export default class UIServerFactory { public static getUIServerImplementation( applicationProtocol: ApplicationProtocol, - options?: ServerOptions, - callback?: () => void + options?: ServerOptions ): AbstractUIServer | null { switch (applicationProtocol) { case ApplicationProtocol.WS: - return new UIWebSocketServer(options ?? Configuration.getUIServer().options, callback); + return new UIWebSocketServer(options ?? Configuration.getUIServer().options); default: return null; } diff --git a/src/charging-station/ui-server/UIWebSocketServer.ts b/src/charging-station/ui-server/UIWebSocketServer.ts index da476895..fcfc3097 100644 --- a/src/charging-station/ui-server/UIWebSocketServer.ts +++ b/src/charging-station/ui-server/UIWebSocketServer.ts @@ -10,9 +10,9 @@ import Utils from '../../utils/Utils'; import logger from '../../utils/Logger'; export default class UIWebSocketServer extends AbstractUIServer { - public constructor(options?: ServerOptions, callback?: () => void) { + public constructor(options?: ServerOptions) { super(); - this.uiServer = new Server(options ?? Configuration.getUIServer().options, callback); + this.uiServer = new Server(options ?? Configuration.getUIServer().options); } public start(): void { diff --git a/src/types/ConfigurationData.ts b/src/types/ConfigurationData.ts index 93b0b75c..9aed2f1f 100644 --- a/src/types/ConfigurationData.ts +++ b/src/types/ConfigurationData.ts @@ -1,10 +1,10 @@ -import { ServerOptions as HttpServerOptions } from 'http'; +import { ListenOptions } from 'net'; import { StorageType } from './Storage'; import { ServerOptions as WSServerOptions } from 'ws'; import type { WorkerChoiceStrategy } from 'poolifier'; import { WorkerProcessType } from './Worker'; -export type ServerOptions = WSServerOptions & HttpServerOptions; +export type ServerOptions = WSServerOptions & ListenOptions; export enum SupervisionUrlDistribution { ROUND_ROBIN = 'round-robin', -- 2.34.1