UNPKG

mini-mqtt-bus

Version:

MQTT client wrapper with event bus for WeChat Mini Programs

30 lines (29 loc) 630 B
export {}; /** * 初始化 MQTT 客户端 * @param options MQTT 连接参数 */ declare function init(options: any): void; /** * 订阅指定主题 */ declare function subscribe(topic: string): void; /** * 取消订阅 */ declare function unsubscribe(topic: string): void; /** * 发布消息 */ declare function publish(topic: string, payload: string): void; /** * 主动断开连接 */ declare function disconnect(): void; export declare const mqttClient: { init: typeof init; subscribe: typeof subscribe; unsubscribe: typeof unsubscribe; publish: typeof publish; disconnect: typeof disconnect; };