Hi, I’m trying to create a thread that will handle chat messaging in my application this way:
Defining global chatController: in the top on the file
IMeetingChatController* m_pChatController;
Defining it after the bot has joined succesfully:
m_pChatController = m_pMeetingService->GetMeetingChatController();
std::cout << "Setting up thread" << std::endl;
m_pChatController->SendChatMsgTo("mesasge before thread", 0, ZOOM_SDK_NAMESPACE::SDKChatMessageType_To_All);
thread(ReadResultsAndSendToChat).detach();
void ReadResultsAndSendToChat(){
std::this_thread::sleep_for(std::chrono::seconds(3));
std::cout << "trying to send chat in thread" << std::endl;
SDKError err = m_pChatController->SendChatMsgTo("mesasge in thread", 0, ZOOM_SDK_NAMESPACE::SDKChatMessageType_To_All);
if (err != SDKERR_SUCCESS) {
std::cout << "Error occurred sending chat: " << err << std::endl;
}
}
The “mesasge before thread” Sent successfully to the chat,
But “mesasge in thread” not sent, Without and SDKError.
What could cause that?
@chunsiong.zoom
I see that this similar to this: Can't send chat messages from a background thread - #4 by chunsiong.zoom
but no answer there too.
I’m trying to achieve that in a certain event, a chat message will be sent.
The events in my application defined by .txt/.json file that gets updated each X seconds.
So, I’m trying to setup a thread that will listen to file changes and accordingly send chat messages.