- Android
- iOS
- JavaScript
即将发布
即将发布
获取聊天室指定属性的值,需要在加入聊天室成功后调用,未加入聊天室获取属性 SDK 会返回空数据。
参数说明
名称 | 类型 | 必填 | 默认值 | 描述 | 版本 |
---|---|---|---|---|---|
chatroom | Object | 是 | 无 | 聊天室对象 | 1.6.0 |
chatroom.id | String | 是 | 无 | 聊天室 ID | 1.6.0 |
chatroom.attributes | Array | 是 | 无 | 聊天室属性列表,数据结构请参考示例代码 | 1.6.0 |
回调说明
属性 | 类型 | 描述 | 版本 |
---|---|---|---|
chatroom | Object | 会话对象 | 1.6.0 |
chatroom.id | String | 聊天室 ID | 1.6.0 |
chatroom.attributes | Array | 聊天室全部属性,数据结构请参考示例代码 | 1.6.0 |
示例代码
let chatroom = {
id: 'chatroom1001',
attributes: [ { key: 'name' }, { key: 'age' }]
};
jim.getChatRoomAttributes(chatroom).then((chatroom) => {
let { id, attributes } = chatroom;
/*
attributes =>
[
{ key: 'name', value: 'xiaoshan' },
{ key: 'age', value: 18 },
]
*/
}, (error) => {
console.log('error', error)
});