简体中文
WuKongIM JavaScript SDK 会话管理功能,包括最近会话同步、监听和操作
需要实现最近会话数据源
const conversations = await WKSDK.shared().conversationManager.sync({})
const listen = (conversation: Conversation, action: ConversationAction) => { if (action === ConversationAction.add) { // 新增最近会话 } else if (action === ConversationAction.update) { // 更新最近会话 } else if (action === ConversationAction.remove) { // 删除最近会话 } }
WKSDK.shared().conversationManager.addConversationListener(listen);
WKSDK.shared().conversationManager.removeConversationListener(listen)
const conversation = WKSDK.shared().conversationManager.findConversation(channel)
WKSDK.shared().conversationManager.removeConversation(channel)
const unreadCount = WKSDK.shared().conversationManager.getAllUnreadCount()
WKSDK.shared().conversationManager.createEmptyConversation(channel)