# 枚举类 (/zh-CN/api-reference/rtm/ios/enumv)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

<a id="areacode"></a>
## AgoraRtmAreaCode [#agorartmareacode]

访问区域，即 SDK 连接的服务器所在的区域。

|       枚举值      | 描述             |
| --------- | ----- |
|   `AgoraRtmAreaCodeCN`    |       `0x00000001`: 中国大陆。    |
|   `AgoraRtmAreaCodeNA`    |       `0x00000002`: 北美区域。    |
|   `AgoraRtmAreaCodeEU`    |       `0x00000004`: 欧洲区域。    |
|   `AgoraRtmAreaCodeAS`    |       `0x00000008`: 除中国大陆以外的亚洲区域。       |
|   `AgoraRtmAreaCodeJP`    |       `0x00000010`: 日本。    |
|   `AgoraRtmAreaCodeIN`    |       `0x00000020`: 印度。    |
|   `AgoraRtmAreaCodeGLOB`  |         `0xFFFFFFFF`: 全球。  |

<a id="channeltype"></a>
## AgoraRtmChannelType [#agorartmchanneltype]

频道类型。

|       枚举值      | 描述             |
| --------- | ----- |
|    `AgoraRtmChannelTypeMessage`  | `1`: Message Channel         |
|    `AgoraRtmChannelTypeStream`  | `2`: Stream Channel       |
| `AgoraRtmChannelTypeUser` | `3`: User Channel |

<a id="encryptionmode"></a>
## AgoraRtmEncryptionMode [#agorartmencryptionmode]

加密方式。

|       枚举值      | 描述             |
| --------- | ----- |
|   `AgoraRtmEncryptionNone`  |         `0`: 不加密。                    |
|   `AgoraRtmEncryptionAES128GCM`    |      `1`: 128 位 AES 加密，GCM 模式。      |
|   `AgoraRtmEncryptionAES256GCM`    |      `2`: 256 位 AES 加密，GCM 模式。       |

<a id="joinchannelfeature"></a>
## AgoraRtmJoinChannelFeature [#agorartmjoinchannelfeature]

加入频道时设置的事件通知类型，你可以通过位操作同时设置多种事件通知。

| 枚举值 | 描述 |
| --- | --- |
| `AgoraRtmJoinChannelFeaturePresence` | `1`: 设置 Presence 事件通知。 |
| `AgoraRtmJoinChannelFeatureMetadata` | `1 << 1`: 设置 Storage 事件通知。 |
| `AgoraRtmJoinChannelFeatureLock` | `1 << 2`: 设置 Lock 事件通知。 |
| `AgoraRtmJoinChannelFeatureBeQuiet` | [enumv-android-ios-cpp-flutter-swift-harmonyos-html-0-4-1 details](#table-slot-enumv-android-ios-cpp-flutter-swift-harmonyos-html-0-4-1) |

<a id="table-slot-enumv-android-ios-cpp-flutter-swift-harmonyos-html-0-4-1"></a>

**enumv-android-ios-cpp-flutter-swift-harmonyos-html-0-4-1 details**

`1 << 3`: 设置静默模式。该模式的行为如下：

- 不影响你接收频道内其他用户的事件通知。
- 频道内其他用户不会收到你加入/离开频道、设置/获取/删除临时状态的事件通知。
- 调用 `whoNow` 方法查询不到自己。
- 调用 `whereNow` 方法查询不到自己静默加入的频道。

<a id="locktype"></a>
## AgoraRtmLockEventType [#agorartmlockeventtype]

Lock 事件类型。

|       枚举值      | 描述             |
| --------- | ----- |
|   `AgoraRtmLockEventTypeSnapshot`  |        `1`: 加入频道时 Lock 的快照信息。        |
|   `AgoraRtmLockEventTypeLockSet`    |      `2`: 已设置 Lock。 |
|   `AgoraRtmLockEventTypeLockRemoved`  |        `3`: 已删除 Lock。       |
|   `AgoraRtmLockEventTypeLockAcquired`    |      `4`: 已获取 Lock。 |
|   `AgoraRtmLockEventTypeLockReleased`  |        `5`: 已释放 Lock。        |
|   `AgoraRtmLockEventTypeLockExpired`    |      `6`: Lock 已过期。 |

<a id="loglevel"></a>
## AgoraRtmLogLevel [#agorartmloglevel]

日志信息的输出等级。

|       枚举值      | 描述             |
| --------- | ----- |
|   `AgoraRtmLogLevelNone`  |         `0x0000`: 不输出任何日志。                     |
|   `AgoraRtmLogLevelInfo`    |       `0x0001`: 输出 `AgoraRtmLogLevelFatal`、`AgoraRtmLogLevelError`、`AgoraRtmLogLevelWarn`、`AgoraRtmLogLevelInfo` 级别的日志。我们推荐你将日志级别设为该等级。      |
|   `AgoraRtmLogLevelWarn`    |       `0x0002`: 仅输出 `AgoraRtmLogLevelFatal`、`AgoraRtmLogLevelError`、`AgoraRtmLogLevelWarn` 级别的日志。        |
|   `AgoraRtmLogLevelError`    |      `0x0004`: 仅输出 `AgoraRtmLogLevelFatal`、`AgoraRtmLogLevelError` 级别的日志。      |
|   `AgoraRtmLogLevelFatal`    |      `0x0008`: 仅输出 `AgoraRtmLogLevelFatal` 级别的日志。      |

<a id="messagepriority"></a>
## AgoraRtmMessagePriority [#agorartmmessagepriority]

消息优先级。

|       枚举值      | 描述             |
| --------- | ----- |
|    `AgoraRtmMessagePriorityHighest` | `0`: 优先级最高。          |
|    `AgoraRtmMessagePriorityHigh`  | `1`: 优先级高。        |
|    `AgoraRtmMessagePriorityNormal`  | `4`: 优先级正常。          |
|    `AgoraRtmMessagePriorityLow`  | `8`: 优先级低。        |

<a id="messageqos"></a>
## AgoraRtmMessageQos [#agorartmmessageqos]

发送 Topic 消息时的 QoS 保障。

|       枚举值      | 描述             |
| --------- | ----- |
|    `AgoraRtmMessageQosUnordered`  | `0`: 消息数据到达时不保序。          |
|    `AgoraRtmMessageQosOrdered`  | `1`: 消息数据到达时保序。          |

<a id="presencetype"></a>
## AgoraRtmPresenceEventType [#agorartmpresenceeventtype]

Presence 事件类型。

|       枚举值      | 描述             |
| --------- | ----- |
|   `AgoraRtmPresenceEventTypeSnapshot`  |        `1`: 加入频道时 Presence 的快照信息。                   |
|   `AgoraRtmPresenceEventTypeInterval`    |      `2`: 当频道内人数达到设定值后，频道内的事件通知将由实时通知转为定时通知。      |
|   `AgoraRtmPresenceEventTypeRemoteJoinChannel`    |      `3`: 远端用户加入频道。      |
|   `AgoraRtmPresenceEventTypeRemoteLeaveChannel`  |        `4`: 远端用户离开频道。                   |
|   `AgoraRtmPresenceEventTypeRemoteConnectionTimeout`    |      `5`: 远端用户连接超时。      |
|   `AgoraRtmPresenceEventTypeRemoteStateChanged`    |    `6`: 远端用户的临时用户状态改变。      |
|   `AgoraRtmPresenceEventTypeErrorOutOfService`    |    `7`: 用户加入频道时未启用 Presence。      |

<a id="linkoperation"></a>
## AgoraRtmLinkOperation [#agorartmlinkoperation]

操作类型。

|       枚举值      | 描述             |
| --------- | ----- |
|   `AgoraRtmLinkOperationLogin`  |        `0`: 登录。                  |
|   `AgoraRtmLinkOperationLogout`    |      `1`: 登出。      |
|   `AgoraRtmLinkOperationJoin`    |      `2`: 加入 Stream Channel。      |
|   `AgoraRtmLinkOperationLeave`    |      `3`: 离开 Stream Channel。      |
|   `AgoraRtmLinkOperationServerReject`    |      `4`: 服务器拒绝。      |
|   `AgoraRtmLinkOperationAutoReconnect`    |      `5`: 自动重连。      |
|   `AgoraRtmLinkOperationReconnected`    |      `6`: 已重连。      |
|   `AgoraRtmLinkOperationHeartbeatTimeout`    |      `7`: 超时未收到心跳包。      |
|   `AgoraRtmLinkOperationServerTimeout`    |      `8`: 服务器超时。      |
|   `AgoraRtmLinkOperationNetworkChange`    |      `9`: 网络发生变化。      |

<a id="linkstate"></a>
## AgoraRtmLinkState [#agorartmlinkstate]

连接状态类型。

|       枚举值      | 描述             |
| --------- | ----- |
|   `AgoraRtmLinkStateIdle`  |        `0`: 初始状态。                  |
|   `AgoraRtmLinkStateConnecting`    |      `1`: 正在连接。      |
|   `AgoraRtmLinkStateConnected`    |      `2`: 已连接。      |
|   `AgoraRtmLinkStateDisconnected`    |      `3`: 已断开连接。      |
|   `AgoraRtmLinkStateSuspended`    |      `4`: 挂起状态。     |
|   `AgoraRtmLinkStateFailed`    |      `5`: 连接失败。      |

<a id="linkstatechangereason"></a>
## AgoraRtmLinkStateChangeReason [#agorartmlinkstatechangereason]

连接状态改变的原因。

|       枚举值      | 描述             |
| --------- | ----- |
|   `AgoraRtmLinkStateChangeReasonUnknown`  |        `0`: 未知原因。                  |
|   `AgoraRtmLinkStateChangeReasonLogin`    |      `1`: 正在登录。      |
|   `AgoraRtmLinkStateChangeReasonLoginSuccess`    |      `2`: 登录成功。      |
|   `AgoraRtmLinkStateChangeReasonLoginTimeout`    |      `3`: 登录超时。      |
|   `AgoraRtmLinkStateChangeReasonLoginNotAuthorized`    |      `4`: 登录未授权。      |
|   `AgoraRtmLinkStateChangeReasonLoginRejected`    |      `5`: 登录被拒绝。      |
|   `AgoraRtmLinkStateChangeReasonRelogin`    |      `6`: 重新登录。      |
|   `AgoraRtmLinkStateChangeReasonLogout`    |      `7`: 登出。      |
|   `AgoraRtmLinkStateChangeReasonAutoReconnect`    |      `8`: 自动重连。      |
|   `AgoraRtmLinkStateChangeReasonReconnectTimeout`    |      `9`: 重连超时。      |
|   `AgoraRtmLinkStateChangeReasonReconnectSuccess`    |      `10`: 重连成功。      |
|   `AgoraRtmLinkStateChangeReasonJoin`    |      `11`: 正在加入频道。      |
|   `AgoraRtmLinkStateChangeReasonJoinSuccess`    |      `12`: 加入频道成功。      |
|   `AgoraRtmLinkStateChangeReasonJoinFailed`    |      `13`: 加入频道失败。      |
|   `AgoraRtmLinkStateChangeReasonRejoin`    |      `14`: 重新加入频道。      |
|   `AgoraRtmLinkStateChangeReasonLeave`    |      `15`: 离开频道。      |
|   `AgoraRtmLinkStateChangeReasonInvalidToken`    |      `16`: Token 无效。      |
|   `AgoraRtmLinkStateChangeReasonTokenExpired`    |      `17`: Token 过期。      |
|   `AgoraRtmLinkStateChangeReasonInconsistentAppId`    |      `18`: App ID 不一致。      |
|   `AgoraRtmLinkStateChangeReasonInvalidChannelName`    |      `19`: 频道名无效。      |
|   `AgoraRtmLinkStateChangeReasonInvalidUserId`    |      `20`: 用户 ID 无效。      |
|   `AgoraRtmLinkStateChangeReasonNotInitialized`    |      `21`: SDK 未初始化。      |
|   `AgoraRtmLinkStateChangeReasonRtmServiceNotConnected`    |      `22`: RTM 服务未连接。      |
|   `AgoraRtmLinkStateChangeReasonChannelInstanceExceedLimitation`    |      `23`: 频道实例超出限制。      |
|   `AgoraRtmLinkStateChangeReasonOperationRateExceedLimitation`    |      `24`: 操作频率超出限制。      |
|   `AgoraRtmLinkStateChangeReasonChannelInErrorState`    |      `25`: 频道处于错误状态。      |
|   `AgoraRtmLinkStateChangeReasonPresenceNotConnected`    |      `26`: Presence 服务未连接。      |
|   `AgoraRtmLinkStateChangeReasonSameUidLogin`    |      `27`: 使用相同用户 ID 登录。      |
|   `AgoraRtmLinkStateChangeReasonKickedOutByServer`    |      `28`: 被服务器踢出。      |
|   `AgoraRtmLinkStateChangeReasonKeepAliveTimeout`    |      `29`: 心跳超时。      |
|   `AgoraRtmLinkStateChangeReasonConnectionError`    |      `30`: 连接错误。      |
|   `AgoraRtmLinkStateChangeReasonPresenceNotReady`    |      `31`: Presence 服务未就绪。      |
|   `AgoraRtmLinkStateChangeReasonNetworkChange`    |      `32`: 网络发生变化。      |
|   `AgoraRtmLinkStateChangeReasonServiceNotSupported`    |      `33`: 服务不支持。      |
|   `AgoraRtmLinkStateChangeReasonStreamChannelNotAvailable`    |      `34`: Stream Channel 不存在。      |
|   `AgoraRtmLinkStateChangeReasonStorageNotAvailable`    |      `35`: Storage 服务不可用。      |
|   `AgoraRtmLinkStateChangeReasonLockNotAvailable`    |      `36`: Lock 服务不可用。      |
|   `AgoraRtmLinkStateChangeReasonLoginTooFrequent`  | `37`: 登录操作太频繁。|

<a id="protocoltype"></a>
## AgoraRtmProtocolType [#agorartmprotocoltype]

消息传输协议类型。

|       枚举值      | 描述             |
| --------- | ----- |
|   `AgoraRtmProtocolTypeTcpUdp`  |        `0`: TCP 和 UDP 协议。                  |
|   `AgoraRtmProtocolTypeTcpOnly`    |      `1`: 仅 TCP 协议，即双环境都是 TCP 协议。      |

<a id="rtmservicetype"></a>
## AgoraRtmServiceType [#agorartmservicetype]

服务类型。

|       枚举值      | 描述             |
| --------- | ----- |
|   `AgoraRtmServiceTypeMessage`  |          基础服务，包含 Message Channel、User Channel、Presence、Storage 和 Lock 服务。                    |
|   `AgoraRtmServiceTypeStream`    |       Stream Channel 服务。      |

:::info[信息]
如需使用 RTM 的全部服务，你可以使用位操作同时设置两种服务类型。
:::

<a id="proxytype"></a>
## AgoraRtmProxyType [#agorartmproxytype]

代理类型。

|       枚举值      | 描述             |
| --------- | ----- |
|   `AgoraRtmProxyTypeNone`  |         `0`: 不开启 Proxy。                    |
|   `AgoraRtmProxyTypeHttp`    |       `1`: 开启 HTTP 协议的 Proxy。      |
|   `AgoraRtmProxyTypeCloudTcp`    |       `2`: 开启 TCP 协议的 Cloud Proxy。      |

<a id="storageeventtype"></a>
## AgoraRtmStorageEventType [#agorartmstorageeventtype]

Storage 事件类型。

|       枚举值      | 描述             |
| --------- | ----- |
| `AgoraRtmStorageEventTypeSnapshot` | `1`: 用户第一次订阅 Channl Metadata 或 User Metadata，或加入频道时触发，本地用户会收到此类事件通知。 |
|   `AgoraRtmStorageEventTypeSet`    | `2`: 当调用 `setChannelMetadata` 或者 `setUserMetadata` 时触发。该事件仅在增量数据更新模式下返回。 |
|  `AgoraRtmStorageEventTypeUpdate`  | `3`: 当调用设置、更新或删除 Channel Metadata 或 User Metadata 的方法时会返回该类型事件。|
|  `AgoraRtmStorageEventTypeRemove`  | `4`: 当调用 `removeChannelMetadata` 或者 `removeUserMetadata` 时触发。该事件仅在增量数据更新模式下返回。  |

<a id="storagetype"></a>
## AgoraRtmStorageType [#agorartmstoragetype]

Storage 类型。

|       枚举值      | 描述             |
| --------- | ----- |
|   `AgoraRtmStorageTypeUser`  |        `1`: User Metadata 事件。         |
|   `AgoraRtmStorageTypeChannel`    |      `2`: Channel Metadata 事件。 |

<a id="subscribechannelfeature"></a>
## AgoraRtmSubscribeChannelFeature [#agorartmsubscribechannelfeature]

订阅频道时设置的事件通知类型，你可以通过位操作同时设置多种事件通知。

| 枚举值 | 描述 |
| --- | --- |
| `AgoraRtmSubscribeChannelFeatureNone` | `0`: 不设置事件通知。 |
| `AgoraRtmSubscribeChannelFeaturePresence` | `1`: 设置 Presence 事件通知。 |
| `AgoraRtmSubscribeChannelFeatureMetadata` | `1 << 1`: 设置 Storage 事件通知。 |
| `AgoraRtmSubscribeChannelFeatureMessage` | `1 << 2`: 设置消息事件通知。 |
| `AgoraRtmSubscribeChannelFeatureLock` | `1 << 3`: 设置 Lock 事件通知。 |
| `AgoraRtmSubscribeChannelFeatureBeQuiet` | [enumv-android-ios-cpp-flutter-swift-harmonyos-html-1-6-1 details](#table-slot-enumv-android-ios-cpp-flutter-swift-harmonyos-html-1-6-1) |

<a id="table-slot-enumv-android-ios-cpp-flutter-swift-harmonyos-html-1-6-1"></a>

**enumv-android-ios-cpp-flutter-swift-harmonyos-html-1-6-1 details**

`1 << 4`: 设置静默模式。该模式的行为如下：

- 不影响你接收频道内其他用户的事件通知。
- 频道内其他用户不会收到你订阅/取消订阅频道、设置/获取/删除临时状态的事件通知。
- 调用 `whoNow` 方法查询不到自己。
- 调用 `whereNow` 方法查询不到自己静默订阅的频道。

<a id="topictype"></a>
## AgoraRtmTopicEventType [#agorartmtopiceventtype]

Topic 事件类型。

|       枚举值      | 描述             |
| --------- | ----- |
|   `AgoraRtmTopicEventTypeSnapshot`  |   `1`: 加入频道时 Topic 的快照信息。                  |
|   `AgoraRtmTopicEventTypeRemoteJoinTopic`    | `2`: 远端用户加入 Topic。      |
|   `AgoraRtmTopicEventTypeRemoteLeaveTopic`    |  `3`: 远端用户离开 Topic。      |
