# libtmux.control:reconnect

- **Package:** libtmux/control
- **Language:** Common Lisp
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-lisp/blob/c2e5fc4ed3befda21f45dfa5d5868c38fd138311/src/control.lisp#L170
- **Public owner:** libtmux.control
- **Page:** https://libtmux.org/en/lisp/latest/reference/libtmux-control-reconnect/

```
(reconnect connection &key (timeout 30) (request-limit nil request-limit-p) (event-limit nil event-limit-p) (event-byte-limit nil event-byte-limit-p) (reply-byte-limit nil reply-byte-limit-p))
```

Retire CONNECTION and return a fresh connection and complete snapshot.
Use the original core client and exact session ID. The client must remain open
in the original generation. Explicitly supplied limits must be positive integers;
omitted queue/reply limits inherit the old connection. TIMEOUT is nonnegative
real seconds shared across preflight, retirement, recapture and startup;
preparation and cleanup can add wall time. Capture output shares the core
client's output budget. Concurrent core work signals LIBTMUX:CLIENT-BUSY.
Preflight refusal leaves a live old connection alone. After successful close,
renew the core generation even if later work fails. Every earlier core capture
from that client becomes stale for operations, while local data remains usable.
The returned snapshot precedes new attachment; it does not include that new
frontend. A closing/closed old resource remains reconnectable with valid origin.
Old requests/results/events stay on the retired resource. Pending work is closed,
never replayed; dispatched effects can remain uncertain. Other separately owned
control resources remain independent. No event continuity or replay is implied.
The CLOSE-CONNECTION generic runs on the caller thread; its failures are retained.
CONNECTION-STALE refuses changed origin/session/daemon. Old cleanup failures
retain the old resource; startup failures retain the new candidate through
CONNECTION-START-FAILED. After failed cutover, acquire/select and open anew.
Use WITH-RECONNECTION or close the returned resource explicitly.

See also: `libtmux.control:await-request`, `libtmux.control:close-connection`, `libtmux.control:connection-stale`, `libtmux.control:with-reconnection`.

## Parameters

- `connection`
- `timeout?`
- `request-limit?`
- `event-limit?`
- `event-byte-limit?`
- `reply-byte-limit?`
