timeout property

Duration get timeout

Duration the session remains alive after the last HTTP request.

The duration the session remains alive, before it is automatically terminated. The timeout timer is restarted with this value when a new HTTP request is received that is associated with the session.

This value is set by the session's constructor or by the timeout setter.

Implementation

Duration get timeout => _timeout;
set timeout (Duration newTimeout)

Sets the expiry duration and restarts the timer to that new value.

This method is used to change the expiry duration. Setting the expiry duration also restarts the timer.

The expiry duration is also set by the Session constructor, so this method is only required if a different expiry duration is required after the session has been created.

The newTimeout cannot be null. Since all active sessions are kept in memory and explicit terminate usually can't be guaranteed, they must expire otherwise the server could run out of memory.

Implementation

set timeout(Duration newTimeout) {
  ArgumentError.checkNotNull(newTimeout);

  _timeout = newTimeout;
  _refresh();
}