ResponsePayload,
} from '../../types/UIProtocol';
import type AbstractUIService from './ui-services/AbstractUIService';
+import UIServiceFactory from './ui-services/UIServiceFactory';
export abstract class AbstractUIServer {
public readonly chargingStations: Map<string, ChargingStationData>;
return [id, responsePayload];
}
+ protected registerProtocolVersionUIService(version: ProtocolVersion): void {
+ if (this.uiServices.has(version) === false) {
+ this.uiServices.set(version, UIServiceFactory.getUIServiceImplementation(version, this));
+ }
+ }
+
protected isBasicAuthEnabled(): boolean {
return (
this.uiServerConfiguration.authentication?.enabled === true &&
import logger from '../../utils/Logger';
import Utils from '../../utils/Utils';
import { AbstractUIServer } from './AbstractUIServer';
-import UIServiceFactory from './ui-services/UIServiceFactory';
import { UIServiceUtils } from './ui-services/UIServiceUtils';
const moduleName = 'UIHttpServer';
error
);
});
- if (this.uiServices.has(version) === false) {
- this.uiServices.set(version, UIServiceFactory.getUIServiceImplementation(version, this));
- }
+ this.registerProtocolVersionUIService(version);
if (req.method === 'POST') {
const bodyBuffer = [];
req
import logger from '../../utils/Logger';
import Utils from '../../utils/Utils';
import { AbstractUIServer } from './AbstractUIServer';
-import UIServiceFactory from './ui-services/UIServiceFactory';
import { UIServiceUtils } from './ui-services/UIServiceUtils';
const moduleName = 'UIWebSocketServer';
);
ws.close(WebSocketCloseEventStatusCode.CLOSE_PROTOCOL_ERROR);
}
- if (this.uiServices.has(version) === false) {
- this.uiServices.set(version, UIServiceFactory.getUIServiceImplementation(version, this));
- }
+ this.registerProtocolVersionUIService(version);
ws.on('message', (rawData) => {
const request = this.validateRawDataRequest(rawData);
if (request === false) {