***

title: connect
slug: /reference/typescript/relay/client/connect
description: Establish the WebSocket connection and authenticate.
max-toc-depth: 3
---------------------

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

[run]: /docs/server-sdks/reference/typescript/relay/client/run

[disconnect]: /docs/server-sdks/reference/typescript/relay/client/disconnect

[ref-relayclient]: /docs/server-sdks/reference/typescript/relay/client

Establish a WebSocket connection to SignalWire RELAY and authenticate. This method
connects to `wss://<host>`, sends a `signalwire.connect` authentication request,
subscribes to the configured contexts, and starts the internal ping loop.

<Note>
  For most use cases, prefer [`run()`][run]
  which calls `connect()` internally and adds automatic reconnection. Use `connect()`
  directly only when you need manual control over the connection lifecycle.
</Note>

## **Parameters**

None.

## **Returns**

`Promise<void>`

## **Example**

```typescript {9}
import { RelayClient } from '@signalwire/sdk';

const client = new RelayClient({
  project: process.env.SIGNALWIRE_PROJECT_ID!,
  token: process.env.SIGNALWIRE_TOKEN!,
  contexts: ['default']
});

await client.connect();
// Connected and authenticated -- do work here
const call = await client.dial(
  [[{ type: 'phone', params: { to_number: '+15559876543', from_number: '+15551234567' } }]],
);
await call.hangup();
await client.disconnect();
```