***

title: disconnect
slug: /reference/typescript/relay/client/disconnect
description: Close the WebSocket connection cleanly.
max-toc-depth: 3
---------------------

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

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

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

Cleanly close the WebSocket connection to SignalWire RELAY. This cancels the
internal ping loop, all pending JSON-RPC requests, any queued
requests waiting for reconnection, and any in-progress dial operations. The
client can be reconnected with
[`connect()`][connect].

<Note>
  When using [`run()`][run], disconnection happens
  automatically on `Ctrl+C` or when a `SIGTERM` is received.
</Note>

## **Parameters**

None.

## **Returns**

`Promise<void>`

## **Example**

```typescript {19}
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();

// Do work ...
const message = await client.sendMessage({
  to: '+15559876543',
  from: '+15551234567',
  body: 'Hello!',
});
await message.wait();

await client.disconnect();
```