- public readonly chargingStations: Map<string, ChargingStationData>;
- protected readonly httpServer: Server;
- protected readonly responseHandlers: Map<string, ServerResponse | WebSocket>;
- protected readonly uiServices: Map<ProtocolVersion, AbstractUIService>;
-
- public constructor(protected readonly uiServerConfiguration: UIServerConfiguration) {
- this.chargingStations = new Map<string, ChargingStationData>();
- this.httpServer = new Server();
- this.responseHandlers = new Map<string, ServerResponse | WebSocket>();
- this.uiServices = new Map<ProtocolVersion, AbstractUIService>();
+ public readonly chargingStations: Map<string, ChargingStationData>
+ public readonly chargingStationTemplates: Set<string>
+ protected readonly httpServer: Server | Http2Server
+ protected readonly responseHandlers: Map<string, ServerResponse | WebSocket>
+ protected readonly uiServices: Map<ProtocolVersion, AbstractUIService>
+
+ public constructor (protected readonly uiServerConfiguration: UIServerConfiguration) {
+ this.chargingStations = new Map<string, ChargingStationData>()
+ this.chargingStationTemplates = new Set<string>()
+ switch (this.uiServerConfiguration.version) {
+ case ApplicationProtocolVersion.VERSION_11:
+ this.httpServer = new Server()
+ break
+ case ApplicationProtocolVersion.VERSION_20:
+ this.httpServer = createServer()
+ break
+ default:
+ throw new BaseError(
+ `Unsupported application protocol version ${this.uiServerConfiguration.version}`
+ )
+ }
+ this.responseHandlers = new Map<string, ServerResponse | WebSocket>()
+ this.uiServices = new Map<ProtocolVersion, AbstractUIService>()