WuKongIM Docs

JavaScript / Web API Reference

Find common wukongimjssdk configuration, listeners, providers, and models by manager.

This is a lookup page for common entry points, not a replacement for the task guides. The root singleton is WKSDK.shared().

WKSDK and configuration

APIPurpose
WKSDK.shared()SDK singleton for the current page context
config.uid / config.tokenCurrent user identity
config.addrWebSocket endpoint
config.deviceFlag0 App, 1 Web, 2 PC
config.providerApplication data sources
connect() / disconnect()Connect and stop connecting
register(type, factory)Register custom message content
newChannel / newMessageTextConvenience model constructors

ConnectManager

APIPurpose
addConnectStatusListenerObserve connection state
removeConnectStatusListenerRemove a state observer
addConnectDelayListenerObserve heartbeat delay
removeConnectDelayListenerRemove a delay observer
statusCurrent ConnectStatus

States: Disconnect, Connected, Connecting, ConnectFail, and ConnectKick.

ChatManager

APIPurpose
send(content, channel, setting?)Send and return a local Message
sendWithOptions(content, channel, options)Send with advanced options
addMessageListener / removeMessageListenerObserve all incoming and outgoing messages
addMessageStatusListener / removeMessageStatusListenerObserve server send results
syncMessages(channel, options)Synchronize through the provider
syncMessageExtrasSynchronize message extra data

ConversationManager

APIPurpose
sync(filter?)Synchronize conversations from the application provider
conversationsCurrent in-memory conversation list
findConversation(channel)Find one conversation
createEmptyConversation(channel)Create an empty conversation
removeConversation(channel)Remove an in-memory row
getAllUnreadCount()Total all unread counts
addConversationListener / removeConversationListenerObserve list changes

ChannelManager

APIPurpose
fetchChannelInfo(channel)Fetch a profile through the provider
getChannelInfo(channel)Read a cached profile
addListener / removeListenerObserve profile changes
syncSubscribes(channel)Synchronize group subscribers
getSubscribes(channel)Read cached subscribers

Common providers

ConfigurationResult
connectAddrCallbackSupplies a WebSocket endpoint through a callback
channelInfoCallbackPromise<ChannelInfo>
syncSubscribersCallbackPromise<Subscriber[]>
syncConversationsCallbackPromise<Conversation[]>
syncMessagesCallbackPromise<Message[]>
messageUploadTaskCallbackMessageTask

Common models

Channel, ChannelInfo, Subscriber, Message, MessageContent, MessageText, MessageImage, Conversation, SyncOptions, and SendOptions.

Common channel types: ChannelTypePerson and ChannelTypeGroup. Local message states: MessageStatus.Wait, MessageStatus.Normal, and MessageStatus.Fail.

On this page