import type { IMessage } from './message.js'; import type { OcppRequest, OcppResponse, CallAction, HandlerProperties } from '@citrineos/types'; /** * MessageHandler * * The interface for all message handlers. * */ export interface IMessageHandler { /** * Subscribes to messages based on actions and context filters. * * @param identifier - The identifier to subscribe for. * @param actions - Optional. The list of call actions to subscribe to. * @param filter - Optional. An additional message context filter. **Note**: Might not be supported by all implementations. @see {@link IMessageContext} for available attributes. * @returns A promise that resolves to a boolean value indicating whether the initialization was successful. */ subscribe(identifier: string, actions?: CallAction[], filter?: { [k: string]: string; }): Promise; /** * Unsubscribe from messages. E.g. when a connection drops. * * @param identifier - The identifier to unsubscribe from. * @returns A promise that resolves to a boolean value indicating whether the unsubscription was successful. */ unsubscribe(identifier: string): Promise; /** * Handles incoming messages. * @param message - The message to be handled. * @param props - Optional properties for the handler. */ handle(message: IMessage, props?: HandlerProperties): void; /** * Shuts down the handler. Unregister all handlers and opening up any resources. */ shutdown(): Promise; get module(): any | undefined; set module(value: any | undefined); }