# LibTmux.PsmuxServer.ConnectAsync

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** C#
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/cf34b255c896d19a97e7d7fabea58609c916012d/src/LibTmux/Psmux/PsmuxServer.cs#L57
- **Page:** https://libtmux.org/en/csharp/latest/reference/libtmux-psmuxserver-connectasync/

```
LibTmux.PsmuxServer.ConnectAsync(options: PsmuxConnectionOptions, cancellationToken: CancellationToken) -> Task<PsmuxServer>
```

Connects to a separately provisioned psmux namespace.

## Parameters

- `options` (`PsmuxConnectionOptions`): The executable trust and isolated endpoint settings.
- `cancellationToken` (`CancellationToken`): Cancels process startup and discovery.

## Returns

A query-only psmux server observation.

## Raises

- [`ArgumentNullException`](https://learn.microsoft.com/dotnet/api/system.argumentnullexception): <paramref name="options" /> is null.
- [`InvalidOperationException`](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception): The selected namespace has no live session.
- [`NotSupportedException`](https://learn.microsoft.com/dotnet/api/system.notsupportedexception): The executable, build, namespace, session count, or requested behavior is outside
the audited preview contract.
- [`LibTmuxException`](/en/csharp/latest/reference/libtmux-libtmuxexception/): The verified client could not complete discovery.
