messageId: string,
messagePayload: JsonType,
commandName: RequestCommand,
- params: RequestParams = defaultRequestParams,
+ params?: RequestParams,
): Promise<ResponseType> {
params = {
...defaultRequestParams,
messagePayload: JsonType | OCPPError,
messageType: MessageType,
commandName: RequestCommand | IncomingRequestCommand,
- params: RequestParams = defaultRequestParams,
+ params?: RequestParams,
): Promise<ResponseType> {
params = {
...defaultRequestParams,
const self = this;
// Send a message through wsConnection
return promiseWithTimeout(
- new Promise((resolve, reject) => {
+ new Promise<ResponseType>((resolve, reject) => {
/**
* Function that will receive the request's response
*
PerformanceStatistics.endMeasure(commandName, beginId);
}
const wsClosedOrErrored = !wsOpened || sendError === true;
- if (wsClosedOrErrored && params.skipBufferingOnError === false) {
+ if (wsClosedOrErrored && params?.skipBufferingOnError === false) {
// Buffer
chargingStation.bufferMessage(messageToSend);
// Reject and keep request in the cache