> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# SignalWire

> Main entry point for the SignalWire Browser SDK.

`SignalWire` is the top-level client for the Browser SDK and the only class
applications instantiate directly. A single instance owns the WebSocket
transport, the authenticated session, the local media-device controller, and
the call factory used by [`dial`](#dial). Every other entity in the SDK —
[`WebRTCCall`](/docs/browser-sdk/v4/reference/webrtc-call),
[`User`](/docs/browser-sdk/v4/reference/user),
[`Address`](/docs/browser-sdk/v4/reference/address) — is produced or fetched
through it.

Lifecycle: construct with a [`CredentialProvider`](/docs/browser-sdk/v4/reference/interfaces/credential-provider),
then await connection-readiness via [`ready$`](#ready-1) or [`connect`](#connect)
before placing or receiving calls. Calls to [`register`](#register) opt the
user into inbound calls; [`unregister`](#unregister) reverses it.
[`destroy`](#destroy) tears down all transports, timers, and subscriptions —
hold a reference to the client for the lifetime of your app and call
`destroy()` exactly once on tear-down.

Device management methods (`enable*`, `disable*`, `select*`, `applySelected*`)
operate on a shared device pool surfaced through observable accessors
(`audioInputDevices$`, `selectedVideoInputDevice$`, etc.). Selections are
persisted via the configured `StorageManager` when
[`ClientPreferences.enableSavePreferences`](/docs/browser-sdk/v4/reference/client-preferences/enable-save-preferences)
is set. Most state is exposed in two forms — a snapshot getter and an
observable (`$`) for reactive UI binding.

## **Examples**

```ts
const client = new SignalWire(new StaticCredentialProvider({ token: 'YOUR_TOKEN' }));
await client.connect();
await client.register();
client.errors$.subscribe(err => console.error(err));
const call = await client.dial('/public/my-room', { audio: true, video: true });
```

## **Extends**

* `Destroyable`

## **Implements**

* [`DeviceController`](/docs/browser-sdk/v4/reference/interfaces/device-controller)

## **Constructors**

### Constructor

```ts
new SignalWire(credentialProvider, options?): SignalWire
```

Creates a new SignalWire client and begins connecting.

#### Parameters

**`credentialProvider`** `CredentialProvider | undefined` — required

Provider that supplies authentication credentials. See [`CredentialProvider`](/docs/browser-sdk/v4/reference/interfaces/credential-provider).

---

**`options`** `SignalWireOptions`

Configuration options (connection, device monitoring, preferences). See [`SignalWireOptions`](/docs/browser-sdk/v4/reference/interfaces/signalwire-options).

---

## **Properties**

**`preferences`** `ClientPreferences` — required

Global SDK preferences (timeouts, ICE config, media defaults).

---

## **Accessors**

#### [audioInputDevices\$](/docs/browser-sdk/v4/reference/signalwire/audio-input-devices\$)

Observable list of available audio input (microphone) devices.

#### [audioInputDisabled\$](/docs/browser-sdk/v4/reference/signalwire/audio-input-disabled\$)

Observable that emits `true` when audio input is disabled (receive-only).

#### [audioOutputDevices\$](/docs/browser-sdk/v4/reference/signalwire/audio-output-devices\$)

Observable list of available audio output (speaker) devices.

#### [destroyed\$](/docs/browser-sdk/v4/reference/signalwire/destroyed\$)

Observable that emits when the instance is destroyed

#### [deviceRecovered\$](/docs/browser-sdk/v4/reference/signalwire/device-recovered\$)

Observable that emits when the SDK auto-switches a device.

#### [directory\$](/docs/browser-sdk/v4/reference/signalwire/directory\$)

Observable that emits the `Directory` instance once the client is connected, or `undefined` while disconnected.

#### [errors\$](/docs/browser-sdk/v4/reference/signalwire/errors\$)

Observable stream of errors from transport, authentication, and devices.

#### [isConnected\$](/docs/browser-sdk/v4/reference/signalwire/is-connected\$)

Observable that emits when the connection state changes.

#### [isRegistered\$](/docs/browser-sdk/v4/reference/signalwire/is-registered\$)

Observable that emits when the user registration state changes.

#### [platformCapabilities](/docs/browser-sdk/v4/reference/signalwire/platform-capabilities)

Platform WebRTC capabilities detected at construction time.

#### [ready\$](/docs/browser-sdk/v4/reference/signalwire/ready\$)

Observable that emits `true` when the client is both connected and authenticated.

#### [selectedAudioInputDevice\$](/docs/browser-sdk/v4/reference/signalwire/selected-audio-input-device\$)

Observable of the currently selected audio input device.

#### [selectedAudioInputDeviceConstraints](/docs/browser-sdk/v4/reference/signalwire/selected-audio-input-device-constraints)

Media track constraints for the selected audio input device. Returns `false` when disabled.

#### [selectedAudioOutputDevice\$](/docs/browser-sdk/v4/reference/signalwire/selected-audio-output-device\$)

Observable of the currently selected audio output device.

#### [selectedVideoInputDevice\$](/docs/browser-sdk/v4/reference/signalwire/selected-video-input-device\$)

Observable of the currently selected video input device.

#### [selectedVideoInputDeviceConstraints](/docs/browser-sdk/v4/reference/signalwire/selected-video-input-device-constraints)

Media track constraints for the selected video input device. Returns `false` when disabled.

#### [session](/docs/browser-sdk/v4/reference/signalwire/session)

The underlying client session for advanced RPC operations.

#### [user\$](/docs/browser-sdk/v4/reference/signalwire/user\$)

Observable that emits the `User` profile once fetched, or `undefined` before authentication completes.

#### [videoInputDevices\$](/docs/browser-sdk/v4/reference/signalwire/video-input-devices\$)

Observable list of available video input (camera) devices.

#### [videoInputDisabled\$](/docs/browser-sdk/v4/reference/signalwire/video-input-disabled\$)

Observable that emits `true` when video input is disabled (receive-only).

#### [warnings\$](/docs/browser-sdk/v4/reference/signalwire/warnings\$)

Observable stream of non-fatal SDK warnings (e.g. credential refresh fallback).

## **Methods**

#### [applySelectedAudioOutputDevice](/docs/browser-sdk/v4/reference/signalwire/apply-selected-audio-output-device)

Apply the currently selected audio output device to an HTMLMediaElement (e.g.

#### [clearDeviceState](/docs/browser-sdk/v4/reference/signalwire/clear-device-state)

Clears all device state and re-enumerates.

#### [connect](/docs/browser-sdk/v4/reference/signalwire/connect)

Establishes the WebSocket connection and authenticates the session.

#### [destroy](/docs/browser-sdk/v4/reference/signalwire/destroy)

Destroys the client, clearing timers and releasing all resources.

#### [deviceInfoToConstraints](/docs/browser-sdk/v4/reference/signalwire/device-info-to-constraints)

Converts a `MediaDeviceInfo` to track constraints suitable for `getUserMedia`.

#### [dial](/docs/browser-sdk/v4/reference/signalwire/dial)

Places an outbound call to the given destination.

#### [disableAudioInput](/docs/browser-sdk/v4/reference/signalwire/disable-audio-input)

Disables audio input (receive-only mode). No audio track will be acquired.

#### [disableDeviceMonitoring](/docs/browser-sdk/v4/reference/signalwire/disable-device-monitoring)

Stops monitoring for media device changes.

#### [disableVideoInput](/docs/browser-sdk/v4/reference/signalwire/disable-video-input)

Disables video input (receive-only mode). No video track will be acquired.

#### [disconnect](/docs/browser-sdk/v4/reference/signalwire/disconnect)

Disconnects the WebSocket and tears down the current session.

#### [enableAudioInput](/docs/browser-sdk/v4/reference/signalwire/enable-audio-input)

Re-enables audio input, restoring the last selection or auto-selecting.

#### [enableDeviceMonitoring](/docs/browser-sdk/v4/reference/signalwire/enable-device-monitoring)

Starts monitoring for media device changes (connect/disconnect).

#### [enableVideoInput](/docs/browser-sdk/v4/reference/signalwire/enable-video-input)

Re-enables video input, restoring the last selection or auto-selecting.

#### [enumerateDevices](/docs/browser-sdk/v4/reference/signalwire/enumerate-devices)

Forces a device re-enumeration.

#### [exportDiagnostics](/docs/browser-sdk/v4/reference/signalwire/export-diagnostics)

Export a structured diagnostic bundle for support/debugging. Includes connection events, call summaries, and device changes.

#### [getDeviceCapabilities](/docs/browser-sdk/v4/reference/signalwire/get-device-capabilities)

Returns the capabilities of a media device.

#### [isValidDevice](/docs/browser-sdk/v4/reference/signalwire/is-valid-device)

Checks whether a device is still available and usable.

#### [preflight](/docs/browser-sdk/v4/reference/signalwire/preflight)

Runs a multi-phase connectivity test against the given destination.

#### [register](/docs/browser-sdk/v4/reference/signalwire/register)

Registers the user as online to receive inbound calls and events.

#### [requestMediaPermissions](/docs/browser-sdk/v4/reference/signalwire/request-media-permissions)

Triggers the browser's media permission dialog and captures the user's device selections.

#### [resetToDefaults](/docs/browser-sdk/v4/reference/signalwire/reset-to-defaults)

Clears all SDK-persisted state and resets to defaults.

#### [selectAudioInputDevice](/docs/browser-sdk/v4/reference/signalwire/select-audio-input-device)

Sets the preferred audio input device.

#### [selectAudioOutputDevice](/docs/browser-sdk/v4/reference/signalwire/select-audio-output-device)

Sets the preferred audio output device.

#### [selectVideoInputDevice](/docs/browser-sdk/v4/reference/signalwire/select-video-input-device)

Sets the preferred video input device.

#### [setStorageManager](/docs/browser-sdk/v4/reference/signalwire/set-storage-manager)

Injects a storage manager into the device controller for persistence.

#### [unregister](/docs/browser-sdk/v4/reference/signalwire/unregister)

Unregisters the user, going offline for inbound calls.