# LibTmux.PsmuxServer.GetSessionAsync

- **Module:** LibTmux.PsmuxServer
- **Package:** LibTmux
- **Language:** .NET
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/6656a563ec9e07ab52e0c3ac96f7704fc94cc0c0/src/LibTmux/Psmux/PsmuxServer.cs#L83
- **Page:** https://libtmux.org/reference/dotnet/libtmux-psmuxserver-getsessionasync/

```
LibTmux.PsmuxServer.GetSessionAsync(cancellationToken: CancellationToken) -> Task<PsmuxSession>
```

Reads the sole visible session.

## Parameters

- `cancellationToken` (CancellationToken) — Cancels the psmux query.

## Returns

The current immutable session observation.

## Raises

- `InvalidOperationException` — The selected namespace no longer has one live session.
- `StaleServerGenerationException` — The sole session was replaced after this server was connected.
- `NotSupportedException` — The selected namespace contains more than one session.
- `LibTmuxException` — The verified client could not complete the query.
