jsy-app/uni_modules/zy-mqtt/utssdk/interface.uts
2024-09-30 10:11:05 +08:00

29 lines
914 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export type MqttManagerOption = {
host : string,
clientId : string,
userName : string,
password : string,
cleanSession ?: boolean, // false 创建可持续会话前提是clientId一直保持不变
automaticReconnect ?: boolean,
heartBeat ?: Int,
timeOut ?: Int
}
type callbackType = (res : UTSJSONObject) => void
export function connect(option : MqttManagerOption, callback : callbackType) : void
export function subscribe(topic : string, qos : Int, callback : callbackType) : void
export function unSubscribe(topic : string, callback : callbackType) : void
export function publishMessage(topic : string, qos : Int, message : string, callback : callbackType) : void
export function disConnect(callback : callbackType) : void
export function onConnectLost(callback : callbackType) : void
export function onReconnect(callback : callbackType) : void
export function getConfig() : UTSJSONObject