> For the complete documentation index, see [llms.txt](https://ksdaemon.gitbook.io/wampy.js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ksdaemon.gitbook.io/wampy.js/api/connect.md).

# connect()

### connect(\[url])

Connects to wamp server. **url** parameter is the same as specified in [Constructor](broken://pages/e80SGqRyzZXRlbWTYu1Y). Returns `promise`:

* Resolved with connection details provided by server (roles, features, authentication details)
* Rejected with [error](broken://pages/e80SGqRyzZXRlbWTYu1Y) happened

```javascript
try {
    await wampy.connect();
} catch (e) {
    console.log('connection failed', e);
}

await ws.connect('/my-socket-path');

let defer = ws.connect('wss://socket.server.com:5000/ws');
```
