Fix Json type definition naming
[e-mobility-charging-stations-simulator.git] / src / charging-station / ui-websocket-services / AbstractUIService.ts
index 42cfa428f1373cc36e1b67bca96661d1eebf6b19..9fd577cdc37ec5b2c896edc76f1276ed93f097b0 100644 (file)
@@ -1,7 +1,7 @@
 import { ProtocolCommand, ProtocolRequestHandler } from '../../types/UIProtocol';
 
 import BaseError from '../../exception/BaseError';
-import { JsonType } from '../../types/JsonType';
+import { JsonObject } from '../../types/JsonType';
 import UIWebSocketServer from '../UIWebSocketServer';
 import logger from '../../utils/Logger';
 
@@ -16,12 +16,12 @@ export default abstract class AbstractUIService {
     ]);
   }
 
-  public async messageHandler(command: ProtocolCommand, payload: JsonType): Promise<void> {
-    let messageResponse: JsonType;
+  public async messageHandler(command: ProtocolCommand, payload: JsonObject): Promise<void> {
+    let messageResponse: JsonObject;
     if (this.messageHandlers.has(command)) {
       try {
         // Call the method to build the message response
-        messageResponse = (await this.messageHandlers.get(command)(payload)) as JsonType;
+        messageResponse = (await this.messageHandlers.get(command)(payload)) as JsonObject;
       } catch (error) {
         // Log
         logger.error(this.uiWebSocketServer.logPrefix() + ' Handle message error: %j', error);
@@ -41,7 +41,7 @@ export default abstract class AbstractUIService {
     this.uiWebSocketServer.broadcastToClients(this.buildProtocolMessage(command, messageResponse));
   }
 
-  protected buildProtocolMessage(command: ProtocolCommand, payload: JsonType): string {
+  protected buildProtocolMessage(command: ProtocolCommand, payload: JsonObject): string {
     return JSON.stringify([command, payload]);
   }