@dfeidao/send-msg
Version:
消息总线
20 lines (19 loc) • 726 B
TypeScript
interface ILogger {
trace(message: string, ...args: string[]): void;
debug(message: string, ...args: string[]): void;
info(message: string, ...args: string[]): void;
warn(message: string, ...args: string[]): void;
error(message: string, ...args: string[]): void;
}
/**
* Push message to any mqtt client
*/
export declare function push(topic: string, body: string, logger: ILogger): Promise<void>;
/**
* Listen mqtt message
*/
export declare function listen(topic: string, callback: (msg: string) => void, logger: ILogger): Promise<{
remove(): void;
}>;
export default function publish<T>(topic: string, response_topic: string, msg: string, timeout: number, logger: ILogger): Promise<T>;
export {};