wasSessionReplaced function

bool wasSessionReplaced({
  1. Duration within = const Duration(seconds: 15),
})

True shortly after session-replaced arrived. The disconnect that follows is then expected: no generic "disconnected" alert, and never an automatic rejoin (which would push the other connection out in turn).

Implementation

bool wasSessionReplaced({Duration within = const Duration(seconds: 15)}) {
  final at = _replacedAt;
  return at != null && DateTime.now().difference(at) < within;
}