---
name: "offMqttConnectState"
mode: "kit"
versionRequirements:
  - { name: "DeviceKit", version: "2.5.1" }
platform:
  - "iOS"
  - "Android"
async: true
title: "offMqttConnectState - 移除监听：mqtt 连接状态变化事件"
---

## offMqttConnectState

> [VERSION] DeviceKit >= 2.5.1

> [PLATFORM] iOS, Android

> ⚡ **支持 Promise 调用** — 不传 success / fail / complete 回调时，该方法返回 Promise。

### 描述

mqtt连接状态变化事件

### 参数

`(listener: Function)`

| 参数 | 类型 | 必填 | 默认值 | 描述 |
| --- | --- | --- | --- | --- |
| `listener` | `(params: MqttConnectStateResponse) => void` | 是 | - | 事件监听回调函数 |

### 引用对象

##### `interface` MqttConnectStateResponse

| 属性 | 类型 | 最低版本 | 描述 |
| --- | --- | --- | --- |
| `connectState` | `number` | `2.5.1` | mqtt连接状态 0 连接失败 1 连接成功 |


### 示例代码

#### Demo

```tsx
const listener = function (res) { console.log(res) }
ty.device.onMqttConnectState(listener)
ty.device.offMqttConnectState(listener)
```
