Core features
Chat is is designed to support in-session text communication. Zoom truncates messages exceeding a binary size of 10,000 bytes. As a best practice, we recommend a limit of 1000 characters per message.
While in a session, users can send chat messages to each other. Two main components implement in-session messaging.
- An instance of
IZoomVideoSDKChatHelperprovides the methods for sending messages. - The
onChatNewMessageNotifycallback on yourIZoomVideoSDKDelegatedelivers incoming messages and confirms your own messages were sent.
To read message metadata, delete messages, and apply host chat privileges, see Manage chat messages. To transfer files, see Send files in chat.
Get the chat helper
Get the chat helper with getChatHelper.
IZoomVideoSDKChatHelper* pChatHelper = m_pVideoSDK->getChatHelper();
Send a public message
To send a message to everyone in the session, call sendChatToAll. Check that chat is enabled first with isChatDisabled.
IZoomVideoSDKChatHelper* pChatHelper = m_pVideoSDK->getChatHelper();
if (pChatHelper->isChatDisabled() == false) {
// Send a message to all users in the session.
pChatHelper->sendChatToAll(strMessage);
}
Send a private message
To send a message to a single user, call sendChatToUser with the recipient's IZoomVideoSDKUser. Private chat can be disabled separately from chat as a whole, so check both isChatDisabled and isPrivateChatDisabled.
IZoomVideoSDKChatHelper* pChatHelper = m_pVideoSDK->getChatHelper();
if (pChatHelper->isChatDisabled() == false && pChatHelper->isPrivateChatDisabled() == false) {
// Send a message to a single user.
pChatHelper->sendChatToUser(pUser, strMessage);
}
Receive incoming messages
To be notified when a message arrives, implement onChatNewMessageNotify on your IZoomVideoSDKDelegate. The messageItem parameter carries the message content and the IZoomVideoSDKUser for both the sender and the recipient.
void CExampleListener::onChatNewMessageNotify(IZoomVideoSDKChatHelper* pChatHelper, IZoomVideoSDKChatMessage* messageItem)
{
if (!messageItem)
return;
const zchar_t* content = messageItem->getContent();
IZoomVideoSDKUser* pSendingUser = messageItem->getSendUser();
IZoomVideoSDKUser* pReceivingUser = messageItem->getReceiveUser();
}
For more information on using the IZoomVideoSDKUser object, see Sessions.