<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@soulmachines/smwebsdk](./smwebsdk.md) &gt; [Scene](./smwebsdk.scene.md) &gt; [connect](./smwebsdk.scene.connect_1.md)

## Scene.connect() method

Connect to a scene at the given server uri.

**Signature:**

```typescript
connect(serverUri?: string, userText?: string, accessToken?: string, retryOptions?: RetryOptions): Promise<string | undefined>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  serverUri | string | _(Optional)_ The server websocket uri to connect to. |
|  userText | string | _(Optional)_ A custom text string that is sent to the orchestration server. |
|  accessToken | string | _(Optional)_ A jwt access token issued to permit access to this server. |
|  retryOptions | [RetryOptions](./smwebsdk.retryoptions.md) | _(Optional)_ Options for customizing connection error retry. |

**Returns:**

Promise&lt;string \| undefined&gt;

Returns a promise that holds success/failure callbacks. If the promise is rejected then an Eror is given as the argument converts to a string message. The error result has two fields 'message' which is the string message and 'name' which is one of the following error name/reason codes: - \*\*notSupported\*\* - the browser does not support getUserMedia - \*\*noUserMedia\*\* - the microphone/camera is either not available, not usable or the user declined permission to use them - \*\*serverConnectionFailed\*\* - the connection to the server failed - \*\*noScene\*\* - no persona was available - \*\*mediaStreamFailed\*\* - the audio/video stream failed - \*\*sessionTimeout\*\* - the session timed out before it was fully available

