# Can't send chat messages from a background thread

**URL:** <https://devforum.zoom.us/t/cant-send-chat-messages-from-a-background-thread/100928>\
**Category:** Meeting SDK\
**Created:** [December 29, 2023, 7:30am UTC](https://devforum.zoom.us/t/cant-send-chat-messages-from-a-background-thread/100928 "2023-12-29T07:30:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pre-fullsend](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@pre-fullsend](https://devforum.zoom.us/u/pre-fullsend)\
**Post date:** [December 29, 2023, 7:30am UTC](https://devforum.zoom.us/t/cant-send-chat-messages-from-a-background-thread/100928/1 "2023-12-29T07:30:01Z")

</div>

**Meeting SDK Type and Version**  
Linux Meeting SDK v5.17.1.1900

**Description**  
I am trying to send chat messages on a background thread but they do not appear in the actual Zoom chat. I do, however, get the chat message callback with the message contents. For some context, I am using a background thread because I want to send meeting reminder chat messages when there are X minutes left in a meeting. The background thread sleeps until the appropriate time to send the reminder message.

**Error?**  
The chat message is supposedly sent successfully with return value `SDKERR_SUCCESS`. I even receive the message in the `onChatMsgNotification` listener correctly. But I do not see the chat message in the actual Zoom meeting chat.

**Troubleshooting Routes**  
I’ve tried upgrading my Meeting SDK to the latest with no luck. I also confirmed I can send the same chat message on the main thread successfully.

**How To Reproduce**

1. Set up a project using [GitHub - zoom/meetingsdk-linux-raw-recording-sample](https://github.com/zoom/meetingsdk-linux-raw-recording-sample)
2. Update the code to create a new background thread and send a chat message.
3. Create a Zoom meeting
4. Start the sample app so it joins the meeting
5. Observe that you receive the message you sent on the background thread in the `onChatMsgNotification` callback
6. Observe that you do NOT see the chat message in the actual Zoom meeting chat.

Let me know if you need me to provide a minimal sample code repository to reproduce this.

---

<div class="post-metadata">

**Author:** ![freelancer.nak](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/freelancer.nak/32/40968_2.png) [@freelancer.nak](https://devforum.zoom.us/u/freelancer.nak)\
**Post date:** [December 29, 2023, 6:36pm UTC](https://devforum.zoom.us/t/cant-send-chat-messages-from-a-background-thread/100928/2 "2023-12-29T18:36:54Z")

</div>

@pre-fullsend Hope you will be fine.

You need to send chat messages from the main thread not from any child or other type of thread.

---

<div class="post-metadata">

**Author:** ![pre-fullsend](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@pre-fullsend](https://devforum.zoom.us/u/pre-fullsend)\
**Post date:** [January 3, 2024, 8:26am UTC](https://devforum.zoom.us/t/cant-send-chat-messages-from-a-background-thread/100928/3 "2024-01-03T08:26:16Z")

</div>

Hi @freelancer.nak, appreciate the response.

Can I get confirmation from the Zoom engineering team that this is indeed the case? Maybe @chunsiong.zoom can confirm that we have to send chat messages on the main thread?

If this is the case, how do you recommend performing background tasks like waiting for a given amount of time before sending a message without blocking other work on the main thread? An event loop architecture would work but I want to avoid introducing unnecessary complexity if possible.

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [January 4, 2024, 12:45am UTC](https://devforum.zoom.us/t/cant-send-chat-messages-from-a-background-thread/100928/4 "2024-01-04T00:45:31Z")

</div>

@pre-fullsend you have to run these in the main thread.

What is the scenario you are trying to achieve?
