# LibTmux.Session.AttachAsync

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** C#
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/cf34b255c896d19a97e7d7fabea58609c916012d/src/LibTmux/Session.Lifecycle.cs#L259
- **Page:** https://libtmux.org/en/csharp/latest/reference/libtmux-session-attachasync/

```
LibTmux.Session.AttachAsync(request: AttachSessionRequest?, cancellationToken: CancellationToken) -> Task<Session>
```

Attaches a client to this session.

Attaching inherits the caller's terminal on stdin and waits for detach.
A positive acknowledgement is required within five seconds, or a shorter
<see cref="ServerConnectionOptions.CommandTimeout" />. CommandTimeout
still bounds the whole attachment; null permits an indefinite interactive
lifetime after acknowledgement. Cancellation stops only the owned client.
<see cref="AttachSessionRequest.Target" /> remains a raw target override;
leave it unset to attach this session by its identifier.

## Parameters

- `request` (`AttachSessionRequest?`): Attachment options.
- `cancellationToken` (`CancellationToken`): Cancels the tmux command.

## Returns

A refreshed handle for this session.
