> 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

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

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

## **Properties**

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

## **Accessors**

Observable list of available audio input (microphone) devices.

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

Observable list of available audio output (speaker) devices.

Observable that emits when the instance is destroyed

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

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

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

Observable that emits when the connection state changes.

Observable that emits when the user registration state changes.

Platform WebRTC capabilities detected at construction time.

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

Observable of the currently selected audio input device.

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

Observable of the currently selected audio output device.

Observable of the currently selected video input device.

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

The underlying client session for advanced RPC operations.

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

Observable list of available video input (camera) devices.

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

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

## **Methods**

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

Clears all device state and re-enumerates.

Establishes the WebSocket connection and authenticates the session.

Destroys the client, clearing timers and releasing all resources.

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

Places an outbound call to the given destination.

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

Stops monitoring for media device changes.

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

Disconnects the WebSocket and tears down the current session.

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

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

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

Forces a device re-enumeration.

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

Returns the capabilities of a media device.

Checks whether a device is still available and usable.

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

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

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

Clears all SDK-persisted state and resets to defaults.

Sets the preferred audio input device.

Sets the preferred audio output device.

Sets the preferred video input device.

Injects a storage manager into the device controller for persistence.

Unregisters the user, going offline for inbound calls.