> 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. # connect > Establish the WebSocket connection and authenticate. [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://`, 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. ## **Parameters** None. ## **Returns** `Promise` ## **Example** ```typescript {9} import { RelayClient } from '@signalwire/sdk'; const client = new RelayClient({ project: process.env.SIGNALWIRE_PROJECT_ID!, token: process.env.SIGNALWIRE_API_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(); ``` > Establish the WebSocket connection and authenticate.