The chat room capability is implemented based on the real-time communication network powered by CommsEase. Users in chat room can interact with each other in real time.
The following are the parameters for Chatroom.getInstance. Here are only some callback functions. For the complete list of parameters for initialization, see chatroom/types.NIMChatroomGetInstanceOptions.
Parameter | Description |
---|---|
appKey | [required] AppKey of the application. |
account | [Required] Account ID. |
token | [Required] Login credentials for the account. |
chatroomId | [Required] Chat room ID. |
chatroomAddresses | [Required] Chat room persistent connection address. |
isAnonymous | Whether to log in in anonymous mode. |
tags | tags for the current connection. |
onconnect | hook function - the callback invoked after the connection is established |
onwillreconnect | Hook function - callback invoked for reconnection |
ondisconnect | hook function - callback invoked when the SDK gets disconnected. |
onmsgs | Hook function - (multi-device sync/online) callback invoked when messages are received. |
onconnect | hook function - the callback invoked after the tags of the current user are updated. |
Chatroom SDK
entry point used to establish persistent connections, login, disconnect from the CommsEase server, destroy the chat room instance and more. For a complete list of APIs, see NIMChatroomInterface
Method | Description |
---|---|
logout | Log out. |
disconnect | Disconnect from the server. |
connect | Connect to the server. |
destroy | Destroy the instance. |
updateTags | Update the tags of the persistent connection. |
getChatroom | Get the profile of a chat room. |
closeChatroom | Close a chat room. |
updateChatroom | Update the profile of a chat room. |
APIs related to members, such as managing administrators, muting or unmuting, updating information in chat rooms, etc. For the complete list of APIs, see NIMChatroomMemberInterface
Method | Description |
---|---|
updateMyChatroomMemberInfo | Update your information in the chat room |
getChatroomMembers | Get a list of chat room members |
getChatroomMembersByTag | Get the number of online chat room members by tag |
getChatroomMemberCountByTag | Query the number of online members by tag. |
markChatroomIdentity | Set the role of a member in the chat room |
markChatroomManager | Set the administrator role for a member. |
markChatroomCommonMember | Set the regular member role for a member. |
markChatroomBlacklist | Add a member to the blocklist. |
markChatroomGaglist | Add a member to the list of muted members. |
kickChatroomMember | Kick a member from the chat room. |
updateChatroomMemberTempMute | Temporarily mute a member in a chat room. |
updateTagMembersTempMute | Temporarily mute a member in a chat room by tag. |
updateCoordinate | Update coordinates. |
Messaging APIs, such as sending a text message, query history message. For the complete list of APIs, see NIMChatroomMessageInterface
Method | Description |
---|---|
sendText | Send a text message. |
sendFile | Send a file message. |
sendCustomMsg | Send a custom message. |
sendTipMsg | Send an alert. |
sendGeo | Send a location message |
getHistoryMsgs | Get the message history of a chat room. |
getHistoryMsgsByTags | Get the message history of a chat room by tag. |
resendMsg | Resend the message. |
Method | Description |
---|---|
queueOffer | Add or update new elements in the queue. |
queuePoll | Delete an element in the queue. |
queueList | Get the queue of a chat room queue |
peak | Get the first element of the queue |
queueDrop | Clear a queue |
queueChange | Update multiple elements in a queue. |
Server-side conversation APIs, such as querying the list of conversations, querying a specific conversation. For information about the complete APIs, see CloudStorageInterface
Method | Description |
---|---|
previewFile | Upload and preview files |
getNosOriginUrl | convert shortened URL to long URL |
audioToText | Audio to Text |
stripImageMeta | Remove metadata of an image |
qualityImage | Modify image quality |
interlaceImage | interlace image |
rotateImage | Rotate an image |
blurImage | Blur an image |
cropImage | Crop images |
thumbnailImage | Generate thumbnails |
processImage | Process images |