聊天室信息

获取聊天室资料与在线成员列表;成员数不设上限。

平台调用风格

异步风格:Promise<RcResult<T>>({ code, data?, msg? });业务错误通过 res.code !== 0 判断,不抛异常。

接口一览​

操作语义传输返回
getChatroomInfo聊天室信息(含在线数)。REST(客户端)Chatroom
getChatroomMembers聊天室在线成员列表。REST(客户端){members:ChatroomMember[], total:uint32}

本页 2 个操作,其中 2 个在本平台绑定中声明了方法签名。

跨端方法名​

操作AndroidWebElectronmacOSFlutterNative (C ABI)iOS
getChatroomInfogetChatroomInfogetChatroomInfogetChatroomInfogetChatroomInfogetChatroomInfoim_client_chatroom_infofunc
getChatroomMembersgetChatroomMembersgetChatroomMembersgetChatroomMembersgetChatroomMembersgetChatroomMembers—func

方法名在 GA 平台之间保持一致(规则 A);Native C ABI 只覆盖部分操作,其余操作以 — 标注。

getChatroomInfo​

聊天室信息(含在线数)。

getChatroomInfo(chatroomId)
REST(客户端)since 1.0.0
参数
参数类型说明
chatroomIdstring必填;聊天室 ID
返回

Chatroom 聊天室资料

示例
JavaScript
const res = await client.getChatroomInfo('cr_2001');
if (res.code !== 0) throw new Error(res.msg);
const data = res.data;
错误码
错误码名称分类HTTP可重试说明
1001INVALID_PARAMETER客户端 / 参数 / 权限400否参数错误
1012CHATROOM_NOT_FOUND客户端 / 参数 / 权限404否聊天室不存在

getChatroomMembers​

聊天室在线成员列表。

getChatroomMembers(chatroomId, options?)
REST(客户端)since 1.0.0
参数
参数类型说明
chatroomIdstring必填;聊天室 ID
options{offset?:uint32,limit?:uint32}可选;选项对象(字段见类型列):{ offset?:uint32, limit?:uint32 }
返回

{members:ChatroomMember[], total:uint32} 在线成员页与总数

示例
JavaScript
const res = await client.getChatroomMembers('cr_2001');
if (res.code !== 0) throw new Error(res.msg);
const data = res.data;
错误码
错误码名称分类HTTP可重试说明
1001INVALID_PARAMETER客户端 / 参数 / 权限400否参数错误
1012CHATROOM_NOT_FOUND客户端 / 参数 / 权限404否聊天室不存在

相关文档​