From: Jérôme Benoit Date: Sat, 14 May 2022 10:14:48 +0000 (+0200) Subject: Fix UI server options type and instantiation signature X-Git-Tag: v1.1.60~10 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b153c0fd46bdc1dc8006e4dac4d4dfa739ff7707;p=e-mobility-charging-stations-simulator.git Fix UI server options type and instantiation signature Signed-off-by: Jérôme Benoit --- 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',