terminate method

Future terminate()

Explicitly terminate a session.

This is used when an application wants to terminate a session without without waiting for it to time out. For example, when the user explicitly logs out.

Important: the application must also remove the session from the Request (i.e. setting it to null) before the request handler returns.

Implementation

Future terminate() async {
  final _existingTimer = _expiryTimer;
  if (_existingTimer != null) {
    _existingTimer.cancel();
    _expiryTimer = null;
  }
  await _terminate(SessionTermination.terminated);
}