Message 类(iOS IMLib)
类继承图
Object→Message
继承关系:Object → Message。该数据结构不包含行为方法,字段与 domain.json → schemas.Message 一一对应。
类说明
消息实体。收发消息、历史消息、搜索、撤回等接口的核心数据结构;seq 由服务端分配,用于会话内排序与分页。rev23 起可选 channelId 表示超级群频道消息(为空即群级消息)。
rev23:channelId 与频道消息
超级群(conversationType=10)消息可带 channelId:仅频道成员接收、历史按频道过滤;sendMessage/getHistoryMessages 通过 options.channelId 指定。路由与权限详见「超级群频道级消息」。
| 项 | 值 |
|---|---|
| 类型 | 数据结构(值对象) |
| 字段数 | 10 |
| IDL 定义 | domain.json → schemas.Message |
| 程序包 | ImpIaaSIM |
| 跨端一致性 | 字段名与取值在 7 个平台绑定中一致;仅语言类型映射不同 |
| 平台状态 | 已交付 |
字段概要
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
messageId | string | 是 | 消息 ID(服务端生成;客户端只读) |
clientMsgId | string | 否 | 客户端消息 ID:发送幂等键,10 分钟内同用户重复使用返回首次结果 |
conversationType | ConversationType | 是 | 会话类型,见 ConversationType |
targetId | string | 是 | 目标 ID(userId / groupId / chatroomId / system) |
channelId | string | 否 | 超级群频道 ID(IDL rev23):conversationType=SUPER_GROUP 时可指定;仅该频道成员接收,历史按 channelId 过滤;为空表示群级消息。 |
senderId | string | 是 | 发送者 userId |
seq | uint64 | 是 | 会话内单调递增,服务端分配 |
timestamp | int64 | 是 | epoch ms |
content | Content | 是 | 消息内容体,见 MessageContent |
direction | Direction | 是 | 消息方向,见 Direction |
详细字段说明
string messageId消息 ID(服务端生成;客户端只读)
string clientMsgId客户端消息 ID:发送幂等键,10 分钟内同用户重复使用返回首次结果
ConversationType conversationType会话类型,见 ConversationType
string targetId目标 ID(userId / groupId / chatroomId / system)
string channelId超级群频道 ID(IDL rev23):conversationType=SUPER_GROUP 时可指定;仅该频道成员接收,历史按 channelId 过滤;为空表示群级消息。
string senderId发送者 userId
uint64 seq会话内单调递增,服务端分配
int64 timestampepoch ms
Content content消息内容体,见 MessageContent
Direction direction消息方向,见 Direction
相关链接
- 关联类型:MessageContent、Conversation、IMPClient
- 关联枚举:ConversationType、Direction、ContentType
- 关联方法:sendMessage、sendTextMessage、sendImageMessage、sendFileMessage、sendVoiceMessage、sendLocationMessage、recallMessage、getMessageReadDetail、searchMessages、getHistoryMessages、getSystemMessages、startStreamMessage
- 返回索引:类 / 枚举