# LibTmux::Control::Connection.connect-async

- **Module:** LibTmux::Control
- **Package:** LibTmux
- **Language:** Raku
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-raku/blob/0b5dd3d32e20f83a0069874e33eab0eb48f55962/lib/LibTmux/Control/Connection.rakumod#L162
- **Page:** https://libtmux.org/en/raku/latest/reference/libtmux-control-connection-connect-async/

```
method connect-async(:$endpoint!, :$session-id!, :$incarnation = Incarnation,
    :$timeout-ms = 10_000, :$cleanup-timeout-ms = 1_000, :$max-pending = 128,
    :$max-output-bytes = 8 * 1024 * 1024, :$max-command-bytes = 12 * 1024,
    :$max-events = 256, :$max-event-bytes = 1024 * 1024,
    :$new-layouts = 'auto', :$cancel = Cancellation --> Promise:D)
```

Resolve to a verified connection or reject after bounded startup cleanup.

Resolve to a verified connection or reject after bounded startup cleanup.

## Parameters

- `$endpoint`
- `$session-id`
- `$incarnation?`
- `$timeout-ms?`
- `$cleanup-timeout-ms?`
- `$max-pending?`
- `$max-output-bytes?`
- `$max-command-bytes?`
- `$max-events?`
- `$max-event-bytes?`
- `$new-layouts?`
- `$cancel?`

## tmux command

The tmux commands behind `connect-async`.

- [`attach-session`](/en/tmux/latest/manual/attach-session/)
- [`refresh-client`](/en/tmux/latest/manual/refresh-client/) (new-layouts negotiation is enabled)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_attach_session_entry`](/en/tmux/latest/reference/c-variable-cmd_attach_session_entry/) (attribute)
- [`cmd_attach_session_exec`](/en/tmux/latest/reference/c-function-cmd-attach-session-c-cmd_attach_session_exec/) (function)
- [`cmd_refresh_client_entry`](/en/tmux/latest/reference/c-variable-cmd_refresh_client_entry/) (attribute)
- [`cmd_refresh_client_exec`](/en/tmux/latest/reference/c-function-cmd-refresh-client-c-cmd_refresh_client_exec/) (function)
