Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Avoid attribute namespace collision
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
  • Loading branch information
Jérôme Benoit committed May 14, 2022
1 parent b153c0f commit d200b69
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"prettier": "^2.6.2",
"release-it": "^15.0.0",
"robohydra": "^0.6.9",
"rollup": "^2.72.1",
"rollup": "^2.73.0",
"rollup-plugin-analyzer": "^4.0.0",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-delete": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/charging-station/ui-server/AbstractUIServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Server as WSServer } from 'ws';
export abstract class AbstractUIServer {
public readonly chargingStations: Set<string>;
protected readonly uiServices: Map<ProtocolVersion, AbstractUIService>;
protected uiServer: WSServer | HttpServer;
protected server: WSServer | HttpServer;

public constructor() {
this.chargingStations = new Set<string>();
Expand Down
8 changes: 4 additions & 4 deletions src/charging-station/ui-server/UIWebSocketServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import logger from '../../utils/Logger';
export default class UIWebSocketServer extends AbstractUIServer {
public constructor(options?: ServerOptions) {
super();
this.uiServer = new Server(options ?? Configuration.getUIServer().options);
this.server = new Server(options ?? Configuration.getUIServer().options);
}

public start(): void {
this.uiServer.on('connection', (socket: WebSocket, request: IncomingMessage): void => {
this.server.on('connection', (socket: WebSocket, request: IncomingMessage): void => {
const protocolIndex = socket.protocol.indexOf(Protocol.UI);
const version = socket.protocol.substring(
protocolIndex + Protocol.UI.length
Expand All @@ -40,7 +40,7 @@ export default class UIWebSocketServer extends AbstractUIServer {
}

public stop(): void {
this.uiServer.close();
this.server.close();
}

public sendResponse(message: string): void {
Expand All @@ -52,7 +52,7 @@ export default class UIWebSocketServer extends AbstractUIServer {
}

private broadcastToClients(message: string): void {
for (const client of (this.uiServer as Server).clients) {
for (const client of (this.server as Server).clients) {
if (client?.readyState === OPEN) {
client.send(message);
}
Expand Down

0 comments on commit d200b69

Please sign in to comment.