> This page is for Browser SDK, version v4 (default).
> For other versions, use one of these documentation indexes:
> - v4 (default): https://signalwire.com/docs/browser-sdk/v4/llms.txt
> - v3: https://signalwire.com/docs/browser-sdk/v3/llms.txt
> - v2: https://signalwire.com/docs/browser-sdk/v2/llms.txt

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# toggleLock

> Toggles the call lock state, preventing or allowing new participants from joining.

```ts
toggleLock(): Promise<void>
```

Toggles the call's `locked` state. While locked, the server rejects new join requests; participants already on the call are unaffected. Useful for closing the door on a meeting once everyone expected has arrived.

The current state is reflected by [`locked$`](/docs/browser-sdk/v4/reference/webrtc-call/locked\$). Requires the `lock` capability — inspect [`call.capabilities$`](/docs/browser-sdk/v4/reference/webrtc-call/capabilities\$) before exposing the control in your UI.

## **Returns**

`Promise<void>` — resolves once the server has acknowledged the state change.

## **Examples**

### Toggle from a UI button

```ts
lockButton.addEventListener('click', async () => {
  await call.toggleLock();
});
```

### Reflect lock state in the UI

```ts
call.locked$.subscribe((locked) => {
  lockButton.textContent = locked ? 'Unlock' : 'Lock';
});
```

## **See**

* [`locked$`](/docs/browser-sdk/v4/reference/webrtc-call/locked\$) — observable of the current lock state.