messageId: string,
messagePayload: JsonType,
commandName: IncomingRequestCommand
- ): Promise<ResponseType> {
+ ): Promise<ResponseType | undefined> {
try {
// Send response message
return await this.internalSendMessage(
messageId: string,
messagePayload: JsonType | OCPPError,
messageType: MessageType,
- commandName?: RequestCommand | IncomingRequestCommand,
+ commandName: RequestCommand | IncomingRequestCommand,
params: RequestParams = {
skipBufferingOnError: false,
triggerMessage: false,
if (wsOpened) {
const beginId = PerformanceStatistics.beginMeasure(commandName);
try {
- chargingStation.wsConnection.send(messageToSend);
+ chargingStation.wsConnection?.send(messageToSend);
logger.debug(
`${chargingStation.logPrefix()} >> Command '${commandName}' sent ${OCPPServiceUtils.getMessageTypeString(
messageType
.then(() => {
resolve(payload);
})
- .catch(error => {
+ .catch((error) => {
reject(error);
})
.finally(() => {
messageId: string,
messagePayload: JsonType | OCPPError,
messageType: MessageType,
- commandName?: RequestCommand | IncomingRequestCommand,
- responseCallback?: ResponseCallback,
- errorCallback?: ErrorCallback
+ commandName: RequestCommand | IncomingRequestCommand,
+ responseCallback: ResponseCallback,
+ errorCallback: ErrorCallback
): string {
let messageToSend: string;
// Type of message