@citrineos/base
Version:
The base module for OCPP v2.0.1 including all interfaces. This module is not intended to be used directly, but rather as a dependency for other modules.
29 lines • 1.06 kB
JavaScript
// SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project
//
// SPDX-License-Identifier: Apache-2.0
import { EventEmitter } from 'events';
import { Logger } from 'tslog';
/**
* Abstract base class for managing a message transport connection.
*
* Implementations are responsible for establishing, maintaining, and closing
* connections to a specific transport backend (e.g. RabbitMQ, Kafka).
*
* Emits:
* - `connected` when a connection is established (with the connection object as argument)
* - `disconnected` when the connection is lost
* - `error` on connection errors
*
* @template TConnection The transport-specific connection type returned by {@link connect}.
*/
export class AbstractConnectionManager extends EventEmitter {
_logger;
state = 'disconnected';
constructor(logger) {
super();
this._logger = logger
? logger.getSubLogger({ name: this.constructor.name })
: new Logger({ name: this.constructor.name });
}
}
//# sourceMappingURL=AbstractConnectionManager.js.map