-
add(clientIds)
→ {Promise.<PartiallySuccess>}
[async]
-
增加成员
Parameters:
| Name |
Type |
Description |
clientIds |
String
|
Array.<String>
|
新增成员 client id |
- Inherited From:
-
blockMembers(clientIds)
→ {Promise.<PartiallySuccess>}
[async]
-
将用户加入该对话黑名单
Parameters:
| Name |
Type |
Description |
clientIds |
String
|
Array.<String>
|
成员 client id |
- Inherited From:
-
count()
→ {Promise.<Number>}
[async]
-
获取对话人数,或暂态对话的在线人数
Returns:
Promise.<Number>
- Inherited From:
-
createMessagesIterator(optionsopt)
→ {AsyncIterater.<Promise.<IteratorResult.<Array.<Message>>>>}
-
获取消息翻页迭代器
Parameters:
| Name |
Type |
Attributes |
Description |
options |
Object
|
<optional>
|
Properties
| Name |
Type |
Attributes |
Description |
beforeTime |
Date
|
<optional>
|
限制起始查询结果为小于该时间之前的消息,不传则为当前时间 |
beforeMessageId |
String
|
<optional>
|
限制起始查询结果为该消息之前的消息,需要与 beforeTime 同时使用,为防止某时刻有重复消息 |
limit |
Number
|
<optional>
|
限制每页查询结果的数量,目前服务端默认为 20 |
|
Returns:
AsyncIterater.<Promise.<IteratorResult.<Array.<Message>>>>
-
AsyncIterator,调用其 next 方法返回获取下一页消息的 Promise
- Inherited From:
Example
var messageIterator = conversation.createMessagesIterator({ limit: 10 });
messageIterator.next().then(function(result) {
// result: {
// value: [message1, ..., message10],
// done: false,
// }
});
messageIterator.next().then(function(result) {
// result: {
// value: [message11, ..., message20],
// done: false,
// }
});
messageIterator.next().then(function(result) {
// No more messages
// result: { value: [], done: true }
});
-
fetch()
→ {Promise.<this>}
[async]
-
从服务器更新对话的属性
Returns:
Promise.<this>
- self
- Inherited From:
-
fetchReceiptTimestamps()
→ {Promise.<this>}
[async]
-
更新对话的最新回执时间戳(lastDeliveredAt、lastReadAt)
Returns:
Promise.<this>
- this
- Since:
- Inherited From:
-
get(key)
→ {Any}
-
获取对话的自定义属性
Parameters:
| Name |
Type |
Description |
key |
String
|
key 属性的键名,'x' 对应 Conversation 表中的 x 列 |
Returns:
Any
- 属性的值
- Since:
- Inherited From:
-
join()
→ {Promise.<this>}
[async]
-
(当前用户)加入该对话
Returns:
Promise.<this>
- self
- Inherited From:
-
mute()
→ {Promise.<this>}
[async]
-
静音,客户端拒绝收到服务器端的离线推送通知
Returns:
Promise.<this>
- self
- Inherited From:
-
muteMembers(clientIds)
→ {Promise.<PartiallySuccess>}
[async]
-
在该对话中禁言成员
Parameters:
| Name |
Type |
Description |
clientIds |
String
|
Array.<String>
|
成员 client id |
- Inherited From:
-
queryBlockedMembers(optionsopt)
→ {PagedResults.<string>}
[async]
-
查询该对话黑名单
Parameters:
| Name |
Type |
Attributes |
Description |
options |
Object
|
<optional>
|
Properties
| Name |
Type |
Attributes |
Description |
limit |
Number
|
<optional>
|
返回的成员数量,服务器默认值 10 |
next |
String
|
<optional>
|
从指定 next 开始查询,与 limit 一起使用可以完成翻页 |
|
Returns:
PagedResults.<string>
- 查询结果。其中的 cureser 存在表示还有更多结果。
- Inherited From:
-
queryMessages(optionsopt)
→ {Promise.<Array.<Message>>}
[async]
-
Parameters:
| Name |
Type |
Attributes |
Description |
options |
Object
|
<optional>
|
Properties
| Name |
Type |
Attributes |
Description |
limit |
Number
|
<optional>
|
限制查询结果的数量,目前服务端默认为 20 |
type |
Number
|
<optional>
|
指定查询的富媒体消息类型,不指定则查询所有消息。 |
direction |
MessageQueryDirection
|
<optional>
|
查询的方向。
在不指定的情况下如果 startTime 大于 endTime,则为从新到旧查询,可以实现加载聊天记录等场景。
如果 startTime 小于 endTime,则为从旧到新查询,可以实现弹幕等场景。 |
startTime |
Date
|
<optional>
|
从该时间开始查询,不传则从当前时间开始查询 |
startMessageId |
String
|
<optional>
|
从该消息之前开始查询,需要与 startTime 同时使用,为防止某时刻有重复消息 |
startClosed |
Boolean
|
<optional>
|
指定查询范围是否包括开始的时间点,默认不包括 |
endTime |
Date
|
<optional>
|
查询到该时间为止,不传则查询最早消息为止 |
endMessageId |
String
|
<optional>
|
查询到该消息为止,需要与 endTime 同时使用,为防止某时刻有重复消息 |
endClosed |
Boolean
|
<optional>
|
指定查询范围是否包括结束的时间点,默认不包括 |
beforeTime |
Date
|
<optional>
|
DEPRECATED: 使用 startTime 代替。限制查询结果为小于该时间之前的消息,不传则为当前时间 |
beforeMessageId |
String
|
<optional>
|
DEPRECATED: 使用 startMessageId 代替。
限制查询结果为该消息之前的消息,需要与 beforeTime 同时使用,为防止某时刻有重复消息 |
afterTime |
Date
|
<optional>
|
DEPRECATED: 使用 endTime 代替。限制查询结果为大于该时间之前的消息 |
afterMessageId |
String
|
<optional>
|
DEPRECATED: 使用 endMessageId 代替。
限制查询结果为该消息之后的消息,需要与 afterTime 同时使用,为防止某时刻有重复消息 |
|
Returns:
Promise.<Array.<Message>>
- 消息列表
- Inherited From:
-
queryMutedMembers(optionsopt)
→ {PagedResults.<string>}
[async]
-
查询该对话禁言成员列表
Parameters:
| Name |
Type |
Attributes |
Description |
options |
Object
|
<optional>
|
Properties
| Name |
Type |
Attributes |
Description |
limit |
Number
|
<optional>
|
返回的成员数量,服务器默认值 10 |
next |
String
|
<optional>
|
从指定 next 开始查询,与 limit 一起使用可以完成翻页。 |
|
Returns:
PagedResults.<string>
- 查询结果。其中的 cureser 存在表示还有更多结果。
- Inherited From:
-
quit()
→ {Promise.<this>}
[async]
-
(当前用户)退出该对话
Returns:
Promise.<this>
- self
- Inherited From:
-
read()
→ {Promise.<this>}
[async]
-
将该会话标记为已读
Returns:
Promise.<this>
- self
- Inherited From:
-
recall(message)
→ {Promise.<RecalledMessage>}
[async]
-
撤回已发送的消息
Parameters:
| Name |
Type |
Description |
message |
AVMessage
|
要撤回的消息,该消息必须是由当前用户发送的。也可以提供一个包含消息 {id, timestamp} 的对象 |
- Inherited From:
-
remove(clientIds)
→ {Promise.<PartiallySuccess>}
[async]
-
剔除成员
Parameters:
| Name |
Type |
Description |
clientIds |
String
|
Array.<String>
|
成员 client id |
- Inherited From:
-
save()
→ {Promise.<this>}
[async]
-
保存当前对话的属性至服务器
Returns:
Promise.<this>
- self
- Inherited From:
-
send(message, optionsopt)
→ {Promise.<Message>}
[async]
-
发送消息
Parameters:
| Name |
Type |
Attributes |
Description |
message |
Message
|
|
消息,Message 及其子类的实例 |
options |
Object
|
<optional>
|
since v3.3.0,发送选项
Properties
| Name |
Type |
Attributes |
Description |
transient |
Boolean
|
<optional>
|
since v3.3.1,是否作为暂态消息发送 |
receipt |
Boolean
|
<optional>
|
是否需要回执,仅在普通对话中有效 |
will |
Boolean
|
<optional>
|
since v3.4.0,是否指定该消息作为「掉线消息」发送,
「掉线消息」会延迟到当前用户掉线后发送,常用来实现「下线通知」功能 |
priority |
MessagePriority
|
<optional>
|
消息优先级,仅在暂态对话中有效,
see: MessagePriority |
pushData |
Object
|
<optional>
|
消息对应的离线推送内容,如果消息接收方不在线,会推送指定的内容。其结构说明参见: 推送消息内容 |
|
- Inherited From:
-
set(key, value)
→ {this}
-
设置对话的自定义属性
Parameters:
| Name |
Type |
Description |
key |
String
|
属性的键名,'x' 对应 Conversation 表中的 x 列,支持使用 'x.y.z' 来修改对象的部分字段。 |
value |
Any
|
属性的值 |
Returns:
this
- self
- Since:
- Inherited From:
Example
// 设置对话的 color 属性
conversation.set('color', {
text: '#000',
background: '#DDD',
});
// 设置对话的 color.text 属性
conversation.set('color.text', '#333');
-
toFullJSON()
→ {Object}
-
Returns:
Object
- 返回值是一个 plain Object
- Since:
- Inherited From:
-
toJSON()
→ {Object}
-
返回 JSON 格式的对话
Returns:
Object
- 返回值是一个 plain Object
- Since:
- Inherited From:
-
unblockMembers(clientIds)
→ {Promise.<PartiallySuccess>}
[async]
-
将用户移出该对话黑名单
Parameters:
| Name |
Type |
Description |
clientIds |
String
|
Array.<String>
|
成员 client id |
- Inherited From:
-
unmute()
→ {Promise.<this>}
[async]
-
取消静音
Returns:
Promise.<this>
- self
- Inherited From:
-
unmuteMembers(clientIds)
→ {Promise.<PartiallySuccess>}
[async]
-
在该对话中解除成员禁言
Parameters:
| Name |
Type |
Description |
clientIds |
String
|
Array.<String>
|
成员 client id |
- Inherited From:
-
update(message, newMessage)
→ {Promise.<AVMessage>}
[async]
-
修改已发送的消息
Parameters:
| Name |
Type |
Description |
message |
AVMessage
|
要修改的消息,该消息必须是由当前用户发送的。也可以提供一个包含消息 {id, timestamp} 的对象 |
newMessage |
AVMessage
|
新的消息 |
- Inherited From: