listSessions method
Lists the caller's sessions on nodeId — both active (attached) and
detached. The node filters by owner, so only the authenticated user's
sessions are returned.
Implementation
Future<List<DetachedSessionInfo>> listSessions({required String nodeId}) {
_ensureConnected();
final id = newId();
final completer = Completer<List<DetachedSessionInfo>>();
_pendingSessionLists[id] = completer;
_connection!.send(
ControlFrame(DetachedSessionsRequest(requestId: id, nodeId: nodeId)),
);
return completer.future;
}