29 lines
914 B
Plaintext
29 lines
914 B
Plaintext
|
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
|