# Zoom Web SDK onUserLeave not Firing

**URL:** <https://devforum.zoom.us/t/zoom-web-sdk-onuserleave-not-firing/48651>\
**Category:** Web\
**Created:** [April 22, 2021, 8:30pm UTC](https://devforum.zoom.us/t/zoom-web-sdk-onuserleave-not-firing/48651 "2021-04-22T20:30:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![thefantastic4it](https://avatars.discourse-cdn.com/v4/letter/t/a183cd/32.png) [@thefantastic4it](https://devforum.zoom.us/u/thefantastic4it)\
**Post date:** [April 22, 2021, 8:30pm UTC](https://devforum.zoom.us/t/zoom-web-sdk-onuserleave-not-firing/48651/1 "2021-04-22T20:30:08Z")

</div>

**Description**  
I’m trying to log when the user leaves the meeting or the host ends the meeting for all the participants.

**Error**  
The `ZoomMtg.inMeetingServiceListener('onUserLeave'` function doesn’t fire after the user leaves the the meeting.

**Which Web Client SDK version?**  
1.9.0

**To Reproduce(If applicable)**  
Steps to reproduce the behavior:

1. Create a meeting
2. Join the meeting as the Host
3. Leave the meeting

**Device (please complete the following information):**

- Browser: Chrome
- Browser Version 89.0.4389.128 (Official Build) (64-bit)

**Additional context**

These are the logs

```
inMeetingServiceListener onMeetingStatus {meetingStatus: 1}
inMeetingServiceListener onMeetingStatus {meetingStatus: 1}
inMeetingServiceListener onMeetingStatus {meetingStatus: 2}
inMeetingServiceListener onUserJoin {userId: <userid>, userName: <username>, muted: false, audio: null, isHost: true, …}
// Success of init
join meeting success {method: "join", status: true, errorCode: 0, errorMessage: null, result: null}

```

After leaving the meeting there is no log for `onMeetingStatus` or `onUserLeave`

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [April 23, 2021, 9:52pm UTC](https://devforum.zoom.us/t/zoom-web-sdk-onuserleave-not-firing/48651/2 "2021-04-23T21:52:43Z")

</div>

Hey @thefantastic4it,

Thank you for reaching out to the Zoom Developer Forum. First, I’ll note that the onUserLeave event will only fire for users that are still in the meeting. It doesn’t fire for the user that is leaving, prior to them leaving.

Further, the host will not receive the OnMeetingStatus event when the meeting ends as the page redirects before the event is fired. Only participants will receive that event with a status of 3 when the meeting ends.

If that doesn’t help, are you able to provide a code snippet that shows how and where you’re calling the inMeetingServiceListener? If you haven’t already, you can use our [Sample Web App](https://github.com/zoom/sample-app-web) as a reference.

Let me know if that helps.

Thanks,  
Max

---

<div class="post-metadata">

**Author:** ![thefantastic4it](https://avatars.discourse-cdn.com/v4/letter/t/a183cd/32.png) [@thefantastic4it](https://devforum.zoom.us/u/thefantastic4it)\
**Post date:** [April 23, 2021, 11:10pm UTC](https://devforum.zoom.us/t/zoom-web-sdk-onuserleave-not-firing/48651/3 "2021-04-23T23:10:14Z")

</div>

Hi @MaxM,

I was looking at this example [sample web](https://github.com/zoom/sample-app-web/blob/0dcfd8c9be2d2a1cc9f6127f781a776bb06b2495/Local/js/meeting.js#L85-L87).

I don’t quite get `the onUserLeave event will only fire for users that are still in the meeting`, but when will it be fired? because the name suggest `onUserLeave`… so it should be fired when the user is not in the meeting anymore right?. If I got it wrong, what is the purpose of this event?

I’m trying to close the window when the user ends the meeting (the redirection is no good for us). Doesn’t matter if the user is a participant or the host, if the user leaves the meeting (pressing the leave button) our requirement is to close the window.

Thanks,  
William

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [April 26, 2021, 8:50pm UTC](https://devforum.zoom.us/t/zoom-web-sdk-onuserleave-not-firing/48651/4 "2021-04-26T20:50:43Z")

</div>

Hey @thefantastic4it,

Happy to help clarify—to that end, the `onUserLeave` event will fire as expected for users that are not the host (regular participants) as when the host ends the meeting, the page redirects before it has a chance to fire for the _host._

The same is true when it comes to `onMeetingStatus` . For participants of the meeting, you’ll see this event fire. However, the host won’t see this event fire before the page redirects at the end of the meeting.

You can use these methods to detect when a user leaves it just may not work for the host. When it comes to the host, you may want to look into the [meeting.started](https://marketplace.zoom.us/docs/api-reference/webhook-reference/meeting-events/meeting-started) or [meeting.participant\_joined](https://marketplace.zoom.us/docs/api-reference/webhook-reference/meeting-events/participant-joined-meeting) webhooks.

Let me know if this helps to clarify,  
Will

---

<div class="post-metadata">

**Author:** ![thefantastic4it](https://avatars.discourse-cdn.com/v4/letter/t/a183cd/32.png) [@thefantastic4it](https://devforum.zoom.us/u/thefantastic4it)\
**Post date:** [April 27, 2021, 8:41pm UTC](https://devforum.zoom.us/t/zoom-web-sdk-onuserleave-not-firing/48651/5 "2021-04-27T20:41:11Z")

</div>

Hi @will.zoom,

I’ve been testing the `onUserLeave` for the users that are not the host. Can you confirm that the `onUserLeave` it only fires for other participants that remains on the meeting, and the user that leaves just only redirects to the leave url and does not fire an event.

What I really want to know is if there is any event that is trigger after the user leaves the meeting. What I seen so far is that using my logs is that the events are only fired while you are on the call, after you leave you can only expect the redirect url.

Thanks,  
William

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [April 28, 2021, 10:21pm UTC](https://devforum.zoom.us/t/zoom-web-sdk-onuserleave-not-firing/48651/6 "2021-04-28T22:21:23Z")

</div>

Hey @thefantastic4it,

Thank you for your questions, I’m glad that Will was able to clarify my point!

> [@thefantastic4it](#):
>
> Can you confirm that the `onUserLeave` it only fires for other participants that remains on the meeting, and the user that leaves just only redirects to the leave url and does not fire an event.

Yes, that is correct.

> [@thefantastic4it](#):
>
> What I really want to know is if there is any event that is trigger after the user leaves the meeting.

You can use the [meeting.participant\_left](https://marketplace.zoom.us/docs/api-reference/webhook-reference/meeting-events/participant-left) webhook if you want an event that fires when a participant leaves a meeting.

Thanks,  
Max

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [May 29, 2021, 8:21am UTC](https://devforum.zoom.us/t/zoom-web-sdk-onuserleave-not-firing/48651/7 "2021-05-29T08:21:41Z")

</div>

Closed on May 29, 2021, 8:21am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
