/**
* Function that will receive the request's response
*
- * @param payload
- * @param requestPayload
+ * @param {Record<string, unknown> | string} payload
+ * @param {Record<string, unknown>} requestPayload
*/
async function responseCallback(payload: Record<string, unknown> | string, requestPayload: Record<string, unknown>): Promise<void> {
if (self.chargingStation.getEnableStatistics()) {
/**
* Function that will receive the request's rejection
*
- * @param error
+ * @param {OCPPError} error
*/
function rejectCallback(error: OCPPError): void {
if (self.chargingStation.getEnableStatistics()) {
static insertAt = (str: string, subStr: string, pos: number): string => `${str.slice(0, pos)}${subStr}${str.slice(pos)}`;
/**
- * @param {number} [retryNumber=0]
- * @returns {number} - delay in milliseconds
+ * @param {number} [retryNumber=0]
+ * @returns {number} delay in milliseconds
*/
static exponentialDelay(retryNumber = 0): number {
const delay = Math.pow(2, retryNumber) * 100;
return delay + randomSum;
}
+ /**
+ * Convert websocket error code to human readable string message
+ *
+ * @param {number} code websocket error code
+ * @returns {string} human readable string message
+ */
static getWebSocketCloseEventStatusString(code: number): string {
if (code >= 0 && code <= 999) {
return '(Unused)';
public abstract maxElementsPerWorker: number;
/**
- * Create a new `Worker` implementation.
+ * `WorkerAbstract` constructor.
*
* @param {string} workerScript
*/
* Create a new `WorkerDynamicPool`.
*
* @param {string} workerScript
- * @param min
- * @param max
+ * @param {number} min
+ * @param {number} max
*/
constructor(workerScript: string, min: number, max: number,) {
super(workerScript);
/**
*
- * @returns {Promise}
* @private
*/
private startWorker(): void {
* Create a new `WorkerStaticPool`.
*
* @param {string} workerScript
- * @param numberOfThreads
+ * @param {number} numberOfThreads
*/
constructor(workerScript: string, numberOfThreads: number) {
super(workerScript);