detachActiveSession method

Future<ActiveSessionDetachResult> detachActiveSession({
  1. required String nodeId,
  2. String sessionRef = '',
  3. Duration? timeout,
})

Detaches one of the caller's active sessions on nodeId from this connection — used to leave a session whose terminal is busy with a full-screen program. sessionRef is a full id, short handle or prefix; leave it empty to detach the sole active session. The attached client is disconnected by the node.

Implementation

Future<ActiveSessionDetachResult> detachActiveSession({
  required String nodeId,
  String sessionRef = '',
  Duration? timeout,
}) {
  _ensureConnected();
  final id = newId();
  final completer = Completer<ActiveSessionDetachResult>();
  _pendingActiveDetach[id] = completer;
  _connection!.send(
    ControlFrame(
      ActiveSessionDetachRequest(
        requestId: id,
        nodeId: nodeId,
        sessionRef: sessionRef,
        timeoutSeconds: timeout?.inSeconds,
      ),
    ),
  );
  return completer.future;
}