# SubsessionClient.closeAllSubsessions() Stops screen sharing

**URL:** <https://devforum.zoom.us/t/subsessionclient-closeallsubsessions-stops-screen-sharing/104384>\
**Category:** Web\
**Created:** [February 22, 2024, 10:56am UTC](https://devforum.zoom.us/t/subsessionclient-closeallsubsessions-stops-screen-sharing/104384 "2024-02-22T10:56:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![godwin.owonam](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/godwin.owonam/32/53602_2.png) [@godwin.owonam](https://devforum.zoom.us/u/godwin.owonam)\
**Post date:** [February 22, 2024, 10:56am UTC](https://devforum.zoom.us/t/subsessionclient-closeallsubsessions-stops-screen-sharing/104384/1 "2024-02-22T10:56:00Z")

</div>

**Description**  
I observed that when ever I close all the subsessions, the screen sharing is also stopped automatically. I don’t know if this is internally intended, but it doesn’t work well for us.

In my implementation, I am simply calling the ssClient.closeAllSubsessions(), as shown in the snippet below, but it stops the screen sharing and the content I was sharing.

**Browser Console Error**  
There is no console error

**Which Web Video SDK version?**  
1.9.5

**Video SDK Code Snippets**

```auto
const closeAllSubSessions = useCallback(async () => {
    if (ssClient) {
      setRetryOpeningSubsessions(false);
      await ssClient.closeAllSubsessions()
        .catch((err) => {
          console.log(err);

          if (err.reason === 'only host can do the operation') {
            message.error('Nur der Host kann den Vorgang ausführen');
          } else {
            message.error(err.reason)
          }
        });

      console.log('Done');
      console.log('retry-subs', retryOpeningSubsessions);
    }
  }, [ssClient, retryOpeningSubsessions]);

```

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

1. Open subsessions
2. Host remains in the main session
3. Host starts sharing screen
4. Host closes all subsessions
5. See error

---

<div class="post-metadata">

**Author:** ![godwin.owonam](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/godwin.owonam/32/53602_2.png) [@godwin.owonam](https://devforum.zoom.us/u/godwin.owonam)\
**Post date:** [February 22, 2024, 12:39pm UTC](https://devforum.zoom.us/t/subsessionclient-closeallsubsessions-stops-screen-sharing/104384/2 "2024-02-22T12:39:27Z")

</div>

Not to worry. I have found the issue. It was an internal call to stop screen share for participants leaving the sub-sessions to the main session.

I just removed that internal call to mediaStream.stopShareScreen() and it solved the issue. Thanks.

---

<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:** [March 23, 2024, 10:39pm UTC](https://devforum.zoom.us/t/subsessionclient-closeallsubsessions-stops-screen-sharing/104384/3 "2024-03-23T22:39:49Z")

</div>

Closed on March 23, 2024, 10:39pm UTC

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