Description
I have a BOT user joining a meeting on Ubuntu using a headless browser.
On the BOT’s frontend, I’m listening for the following events to determine when it should leave the meeting:
user-removed
connection-change
However, in the meeting below, all other users left the room at 16:28, but my BOT didn’t leave until 16:43.
I would like Zoom to check whether the events above were sent to my BOT at 16:28.
Hi @lmtruong1512, thanks for the detailed explanation.
A few quick questions and suggestions to help troubleshoot this:
Which client-side framework are you using (e.g., React, Vue, plain JavaScript)?
Do you have any setTimeout or timeout logic implemented that might delay the bot from leaving or shutting down the headless browser process?
What’s your intended behavior for the bot:
Should it leave when the host ends the session?
Should it leave if all participants leave?
Or should it end only when the host specifically leaves, regardless of others?
Also, please make sure that all relevant event listeners (user-added, user-updated, user-removed, connection-change, etc.) are bound after client.init() and client.createClient() but before client.join(). If the events are bound too late, the bot might miss critical session updates.
@freelancer.nak Thank you for your response. We just wanted to confirm whether the BOT receives the user-removed event. Also, the additional information you provided is very helpful — thank you so much:
Please make sure that all relevant event listeners (user-added , user-updated , user-removed , connection-change , etc.) are bound after client.init() and client.createClient() but before client.join() . If the events are bound too late, the bot might miss critical session updates.
@vic.yang Hi, just a quick follow-up:
Right after receiving the user-removed event, my BOT calls getParticipantsList().
However, it seems that the removed user might still be present in the list at that moment, which prevents the BOT from detecting that it’s alone and leaving the meeting.
Could you please check whether getParticipantsList() still included the removed user(s) immediately after the user-removed event was fired around 16:28 JST?
Yes, the BOT does receive the user-removed event, so make sure you’re listening for it like this:
client.on('user-removed', (data) => {
// handle user leaving
});
As an alternative, you can periodically call getAllUsers() and compare the result with your current participant list. If a user is missing, that means they’ve left. You can use a polling interval like this:
setInterval(async () => {
const currentUsers = await client.getAllUsers();
// compare currentUsers with your stored participant list
}, 30000); // every 30 seconds (or 120000 for 2 minutes)
And for the current user, use getCurrentUserInfo() to track their session state reliably.