MediaSFU Shared
    Preparing search index...

    Function leaveRoom

    • Leave the room from a headless surface.

      Without this you have to pull socket, localSocket, member and roomName off the bag yourself and hand them to confirmExit — four chances to pass a stale value, and a silent no-op when you do.

      Never throws: a failed exit comes back as { ok: false, error } so a Leave button can report why rather than appearing to work.

      Parameters

      Returns Promise<HeadlessActionResult>

      import { leaveRoom } from 'mediasfu-shared';

      const result = await leaveRoom({
      parameters: parameterStore.getCurrent(),
      endRoomOnHostExit: false,
      });
      if (!result.ok) setNotice(result.error);