new EMChatManager(chatManager)
- Source:
EMChatManager constructor.
Parameters:
Name | Type | Description |
---|---|---|
chatManager |
Object |
Methods
addListener(listener) → {void}
- Source:
Add chat manager listener
Parameters:
Name | Type | Description |
---|---|---|
listener |
EMChatManagerListener | 添加会话的回调监听对象 |
Returns:
- Type
- void
clearListeners() → {void}
- Source:
Remove all the chat manager listeners
Returns:
- Type
- void
conversationWithType(conversationId, type, createIfNotExist) → {void}
- Source:
Get a conversation
Note: All conversations will be loaded from local database.
Parameters:
Name | Type | Description |
---|---|---|
conversationId |
String | 会话ID |
type |
Number | 会话类型,0为单聊,1为群组 |
createIfNotExist |
Bool | 如果会话不存在,是否临时创建 |
Returns:
- Type
- void
downloadMessageAttachments(message) → {void}
- Source:
Download attachment of a message.
Note: User should call this method to download file, voice, image, video.
SDK will callback the user by EMChatManagerListener if user doesn't provide a callback or callback return false.
Parameters:
Name | Type | Description |
---|---|---|
message |
EMMessage | 要下载附件的消息 |
Returns:
- Type
- void
downloadMessageThumbnail(message) → {void}
- Source:
Download thumbnail for image or video message
Note: Image and video message thumbnail will be downloaded automatically. ONLY call this method if automatic download failed.
SDK will callback the user by EMChatManagerListener if user doesn't provide a callback in the message or callback return false.
Parameters:
Name | Type | Description |
---|---|---|
message |
EMMessage | 要下载缩略的消息 |
Returns:
- Type
- void
fetchHistoryMessages(conversationId, type, pageSize, startMsgId) → {Object}
- Source:
fetch conversation roam messages from server.
Parameters:
Name | Type | Description |
---|---|---|
conversationId |
String | 会话ID |
type |
Number | 会话类型,0为单聊,1为群组 |
pageSize |
Number | 分页 |
startMsgId |
String | 开始的消息ID |
Returns:
{code,description,data},code为结果,0为成功,其他失败,description为失败原因,data为消息列表
- Type
- Object
getConversations() → {Array}
- Source:
Get all conversations from cache or local database if not in cache.
Returns:
会话对象列表
- Type
- Array
getMessage(messageId) → {EMMessage}
- Source:
Get message by message Id.
Parameters:
Name | Type | Description |
---|---|---|
messageId |
String | 消息ID |
Returns:
消息
- Type
- EMMessage
insertMessages(list) → {Bool}
- Source:
Insert messages
Parameters:
Name | Type | Description |
---|---|---|
list |
array | message list 插入消息到本地,消息列表 |
Returns:
- Type
- Bool
loadAllConversationsFromDB() → {Array}
- Source:
Get all conversations from local database.
Returns:
会话对象列表
- Type
- Array
recallMessage(message) → {void}
- Source:
Recall a message.
Parameters:
Name | Type | Description |
---|---|---|
message |
EMMessage | 要撤回的消息 |
Returns:
- Type
- void
removeConversation(conversationId, isRemoveMessages) → {void}
- Source:
Remove a conversation from cache and local database.
Note: Before removing a conversation, all conversations must be loaded from local database first
Parameters:
Name | Type | Description |
---|---|---|
conversationId |
String | 要删除的会话ID |
isRemoveMessages |
Bool | 删除会话时,是否移除消息 |
Returns:
- Type
- void
removeConversations(list, isRemoveMessages) → {void}
- Source:
Remove a conversation from cache and local database.
Note: Before removing a conversation, all conversations must be loaded from local database first
Parameters:
Name | Type | Description |
---|---|---|
list |
array | 要删除的会话数组 |
isRemoveMessages |
Bool | 删除会话时,是否移除消息 |
Returns:
- Type
- void
removeListener(listener) → {void}
- Source:
Remove chat manager listener
Parameters:
Name | Type | Description |
---|---|---|
listener |
EMChatManagerListener | 移除会话的回调监听对象 |
Returns:
- Type
- void
resendMessage(message) → {void}
- Source:
Resend a message.
Parameters:
Name | Type | Description |
---|---|---|
message |
EMMessage | 要重发的消息 |
Returns:
- Type
- void
sendMessage(message) → {void}
- Source:
Send a message.
Parameters:
Name | Type | Description |
---|---|---|
message |
EMMessage | 发送的消息 |
Returns:
- Type
- void
sendReadAckForMessage(message) → {void}
- Source:
Send read ask for a message.
Parameters:
Name | Type | Description |
---|---|---|
message |
EMMessage | 发送消息的已读ack |
Returns:
- Type
- void
updateParticipant(from, changeTo) → {bool}
- Source:
update database participant related records, include message table, conversation table, contact table, blacklist table
Parameters:
Name | Type | Description |
---|---|---|
from |
String | 修改前的会话ID |
changeTo |
String | 修改后的会话ID |
Returns:
- Type
- bool
uploadLog() → {void}
- Source:
Upload log to server.上传日志到服务器
Returns:
- Type
- void