new IMClient()
        无法直接实例化,请使用 Realtime#createIMClient 创建新的 IMClient。
    
    
    
    
    
    
    
    
    
    
    
    
    
Extends
Members
Methods
- 
    
    
close() → {Promise} [async]
 - 
    
    关闭客户端
Returns:
Promise - 
    
    
createChatRoom(options) → {Promise.<ChatRoom>} [async]
 - 
    
    创建一个聊天室
Parameters:
Name Type Description optionsObject 除了下列字段外的其他字段将被视为对话的自定义属性 Properties
Name Type Attributes Description nameString <optional> 
对话的名字 Returns:
Promise.<ChatRoom>- Since:
 - 4.0.0
 
 - 
    
    
createConversation(options) → {Promise.<Conversation>} [async]
 - 
    
    创建一个对话
Parameters:
Name Type Description optionsObject 除了下列字段外的其他字段将被视为对话的自定义属性 Properties
Name Type Attributes Default Description membersArray.<String> 对话的初始成员列表,默认包含当前 client nameString <optional> 
对话的名字 uniqueBoolean <optional> 
true 唯一对话,当其为 true 时,如果当前已经有相同成员的对话存在则返回该对话,否则会创建新的对话 Returns:
Promise.<Conversation> - 
    
    
createTemporaryConversation(options) → {Promise.<TemporaryConversation>} [async]
 - 
    
    创建一个临时对话
Parameters:
Name Type Description optionsObject Properties
Name Type Attributes Description membersArray.<String> 对话的初始成员列表,默认包含当前 client ttlString <optional> 
对话存在时间,单位为秒,最大值与默认值均为 86400(一天),过期后该对话不再可用。 Returns:
Promise.<TemporaryConversation>- Since:
 - 4.0.0
 
 - 
    
    
emit(event) → {Boolean}
 - 
    
    依次调用 event 事件的监听器列表中的 listener。
Parameters:
Name Type Attributes Description eventString | Symbol The event name. ...argMixed <optional> 
payloads Returns:
Boolean - `true` if the event had listeners, else `false`.- Inherited From:
 
 - 
    
    
getChatRoomQuery() → {ConversationQuery.<ChatRoom>}
 - 
    
    构造一个 ConversationQuery 来查询聊天室
Returns:
ConversationQuery.<ChatRoom> - 
    
    
getConversation(id, noCacheopt) → {Promise.<ConversationBase>} [async]
 - 
    
    获取某个特定的对话
Parameters:
Name Type Attributes Default Description idString 对话 id,对应 _Conversation 表中的 objectId noCacheBoolean <optional> 
false 强制不从缓存中获取 Returns:
Promise.<ConversationBase> - 如果 id 对应的对话不存在则返回 null - 
    
    
getConversations(ids, noCacheopt) → {Promise.<Array.<ConversationBase>>} [async]
 - 
    
    通过 id 批量获取某个特定的对话
Parameters:
Name Type Attributes Default Description idsArray.<String> 对话 id 列表,对应 _Conversation 表中的 objectId noCacheBoolean <optional> 
false 强制不从缓存中获取 Returns:
Promise.<Array.<ConversationBase>> - 如果 id 对应的对话不存在则返回 null- Since:
 - 3.4.0
 
 - 
    
    
getQuery() → {ConversationQuery.<PersistentConversation>}
 - 
    
    构造一个 ConversationQuery 来查询对话
Returns:
ConversationQuery.<PersistentConversation> - 
    
    
getServiceConversationQuery() → {ConversationQuery.<ServiceConversation>}
 - 
    
    构造一个 ConversationQuery 来查询服务号
Returns:
ConversationQuery.<ServiceConversation> - 
    
    
off(event, listeneropt, contextopt, onceopt) → {this}
 - 
    
    移除 event 事件的监听器列表中的 listener。
Parameters:
Name Type Attributes Description eventString | Symbol The event name. listenerfunction <optional> 
Only remove the listeners that match this function. contextMixed <optional> 
Only remove the listeners that have this context. onceBoolean <optional> 
Only remove one-time listeners. Returns:
this - self.- Inherited From:
 
 - 
    
    
on(event, listener, contextopt) → {this}
 - 
    
    给指定的 event 添加监听器,并将该监听器置于监听器列表的末位。该方法不会检查是否已经添加过该监听器。重复添加相同的 event 和 listener 会导致该事件和监听器被重复触发。
Parameters:
Name Type Attributes Default Description eventString | Symbol The event name. listenerfunction The listener function. contextMixed <optional> 
this The context to invoke the listener with. Returns:
this - self.- Inherited From:
 
 - 
    
    
once(event, listener, contextopt) → {this}
 - 
    
    为 event 事件添加一个一次性的监听器,该事件第一次触发之后就会被注销。
Parameters:
Name Type Attributes Default Description eventString | Symbol The event name. listenerfunction The listener function. contextMixed <optional> 
this The context to invoke the listener with. Returns:
this - self.- Inherited From:
 
 - 
    
    
parseConversation() → {ConversationBase} [async]
 - 
    
    反序列化对话,与 Conversation#toFullJSON 相对。
Parameters:
Type Description Object Returns:
ConversationBase - 解析后的对话- Since:
 - 4.0.0
 
 - 
    
    
parseMessage() → {AVMessage} [async]
 - 
    
    反序列化消息,与 Message#toFullJSON 相对。
Parameters:
Type Description Object Returns:
AVMessage - 解析后的消息- Since:
 - 4.0.0
 
 - 
    
    
ping(clientIds) → {Primse.<Array.<String>>} [async]
 - 
    
    获取 client 列表中在线的 client,每次查询最多 20 个 clientId,超出部分会被忽略
Parameters:
Name Type Description clientIdsArray.<String> 要查询的 client ids Returns:
Primse.<Array.<String>> - 在线的 client ids 
Events
- 
    
    
BLOCKED
 - 
    
    当前用户被加入某个对话的黑名单
Parameters:
Name Type Description payloadObject Properties
Name Type Description blockedByString 该操作的发起者 id conversationConversationBase  - 
    
    
CLOSE
 - 
    
    当前客户端被服务端强行下线
Parameters:
Name Type Description payloadObject Properties
Name Type Description codeNumber 错误码 reasonString 原因  - 
    
    
CONFLICT
 - 
    
    用户在其他客户端登录,当前客户端被服务端强行下线。详见文档「单点登录」章节。
Parameters:
Name Type Description payloadObject Properties
Name Type Description reasonstring 原因  - 
    
    
CONVERSATION_INFO_UPDATED
 - 
    
    该对话信息被更新
Parameters:
Name Type Description payloadObject Properties
Name Type Description attributesObject 被更新的属性 updatedByString 该操作的发起者 id conversationConversationBase  - 
    
    
DISCONNECT
 - 
    
    客户端连接断开
- Since:
 - 3.2.0
 
- See:
 
 - 
    
    
INVITED
 - 
    
    当前用户被添加至某个对话
Parameters:
Name Type Description payloadObject Properties
Name Type Description invitedByString 邀请者 id conversationConversationBase  - 
    
    
KICKED
 - 
    
    当前用户被从某个对话中移除
Parameters:
Name Type Description payloadObject Properties
Name Type Description kickedByString 该移除操作的发起者 id conversationConversationBase  - 
    
    
MEMBER_INFO_UPDATED
 - 
    
    有成员的对话信息被更新
Parameters:
Name Type Description payloadObject Properties
Name Type Description memberString 被更新对话信息的成员 id memberInfoConversationMumberInfo 被更新的成员对话信息 updatedByString 该操作的发起者 id conversationConversationBase  - 
    
    
MEMBERS_BLOCKED
 - 
    
    有成员被加入某个对话的黑名单
Parameters:
Name Type Description payloadObject Properties
Name Type Description membersArray.<String> 成员 id 列表 blockedByString 该操作的发起者 id conversationConversationBase  - 
    
    
MEMBERS_JOINED
 - 
    
    有用户被添加至某个对话
Parameters:
Name Type Description payloadObject Properties
Name Type Description membersArray.<String> 被添加的用户 id 列表 invitedByString 邀请者 id conversationConversationBase  - 
    
    
MEMBERS_LEFT
 - 
    
    有成员被从某个对话中移除
Parameters:
Name Type Description payloadObject Properties
Name Type Description membersArray.<String> 被移除的成员 id 列表 kickedByString 该移除操作的发起者 id conversationConversationBase  - 
    
    
MEMBERS_MUTED
 - 
    
    有成员在某个对话中被禁言
Parameters:
Name Type Description payloadObject Properties
Name Type Description membersArray.<String> 成员 id 列表 mutedByString 该操作的发起者 id conversationConversationBase  - 
    
    
MEMBERS_UNBLOCKED
 - 
    
    有成员被移出某个对话的黑名单
Parameters:
Name Type Description payloadObject Properties
Name Type Description membersArray.<String> 成员 id 列表 unblockedByString 该操作的发起者 id conversationConversationBase  - 
    
    
MEMBERS_UNMUTED
 - 
    
    有成员在某个对话中被解除禁言
Parameters:
Name Type Description payloadObject Properties
Name Type Description membersArray.<String> 成员 id 列表 unmutedByString 该操作的发起者 id conversationConversationBase  - 
    
    
MESSAGE
 - 
    
    当前用户收到消息
Parameters:
Name Type Description messageMessage conversationConversationBase 收到消息的对话  - 
    
    
MESSAGE_RECALL
 - 
    
    消息被撤回
Parameters:
Name Type Attributes Description messageAVMessage 被撤回的消息 conversationConversationBase 消息所在的会话 reasonPatchReason <optional> 
撤回的原因,不存在代表是发送者主动撤回  - 
    
    
MESSAGE_UPDATE
 - 
    
    消息被修改
Parameters:
Name Type Attributes Description messageAVMessage 被修改的消息 conversationConversationBase 消息所在的会话 reasonPatchReason <optional> 
修改的原因,不存在代表是发送者主动修改  - 
    
    
MUTED
 - 
    
    有成员在某个对话中被禁言
Parameters:
Name Type Description payloadObject Properties
Name Type Description mutedByString 该操作的发起者 id conversationConversationBase  - 
    
    
OFFLINE
 - 
    
    进入离线状态。 这通常意味着网络已断开,或者 Realtime#pause 被调用
- Since:
 - 3.4.0
 
 - 
    
    
ONLINE
 - 
    
    恢复在线状态 这通常意味着网络已恢复,或者 Realtime#resume 被调用
- Since:
 - 3.4.0
 
 - 
    
    
RECONNECT
 - 
    
    客户端连接恢复正常,该事件通常在 Realtime#event:RECONNECT 之后发生
- Since:
 - 3.2.0
 
- See:
 
 - 
    
    
RECONNECT_ERROR
 - 
    
    客户端重新登录发生错误(网络连接已恢复,但重新登录错误)
- Since:
 - 3.2.0
 
 - 
    
    
RETRY
 - 
    
    正在尝试重新连接
Parameters:
Name Type Description attemptNumber 尝试重连的次数 - Since:
 - 3.2.0
 
 - 
    
    
SCHEDULE
 - 
    
    计划在一段时间后尝试重新连接
Parameters:
Name Type Description attemptNumber 尝试重连的次数 delayNumber 延迟的毫秒数 - Since:
 - 3.2.0
 
 - 
    
    
UNBLOCKED
 - 
    
    当前用户被移出某个对话的黑名单
Parameters:
Name Type Description payloadObject Properties
Name Type Description unblockedByString 该操作的发起者 id conversationConversationBase  - 
    
    
UNMUTED
 - 
    
    有成员在某个对话中被解除禁言
Parameters:
Name Type Description payloadObject Properties
Name Type Description unmutedByString 该操作的发起者 id conversationConversationBase  - 
    
    
UNREAD_MESSAGES_COUNT_UPDATE
 - 
    
    未读消息数目更新
Parameters:
Name Type Description conversationsArray.<Conversation> 未读消息数目有更新的对话列表 - Since:
 - 3.4.0