Session class abstract
When a call is made to the Server a Session object is created. It contains all data associated with the current connection and provides easy access to the database.
Constructors
Properties
- auth ↔ UserAuthetication
-
Methods related to user authentication.
latefinal
- authenticationKey → String?
-
The authentication key passed from the client.
read-only
- caches → Caches
-
Provides access to all caches used by the server.
read-only
- db ↔ Database
-
Access to the database.
latefinal
- duration → Duration
-
Returns the duration this session has been open.
read-only
- enableLogging → bool
-
True if logging is enabled for this session. Normally, logging should be
enabled but it will be disabled for internal sessions used by Serverpod.
final
- hashCode → int
-
The hash code for this object.
read-onlyinherited
-
isUserSignedIn
→ Future<
bool> -
Returns true if the user is signed in.
read-only
- maxLifeTime → Duration
-
Max lifetime of the session, after it will be forcefully terminated.
final
- messages ↔ MessageCentralAccess
-
Access to the MessageCentral for passing real time messages between
web socket streams and other listeners.
read / write
-
passwords
→ Map<
String, String> -
Map of passwords loaded from config/passwords.yaml
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
-
scopes
→ Future<
Set< Scope>?> -
Returns the scopes associated with an authenticated user.
read-only
- server → Server
-
The Server that created the session.
final
- serverpod → Serverpod
-
The Serverpod this session is running on.
read-only
- sessionLogs ↔ SessionLogEntryCache
-
Log messages saved during the session.
latefinal
- startTime → DateTime
-
The time the session object was created.
read-only
- storage ↔ StorageAccess
-
Provides access to the cloud storages used by this Serverpod.
latefinal
- userObject ↔ dynamic
-
An custom object associated with this Session. This is especially
useful for keeping track of the state in a
StreamingEndpoint
.read / write
Methods
-
close(
{dynamic error, StackTrace? stackTrace}) → Future< int?> -
Closes the session. This method should only be called if you have
manually created a the Session e.g. by calling
createSession
on Serverpod. Closing the session finalizes and writes logs to the database. After a session has been closed, you should not call any more methods on it. Optionally pass in anerror
/exception andstackTrace
if the session ended with an error and it should be written to the logs. Returns the session id, if the session has been logged to the database. -
log(
String message, {LogLevel? level, dynamic exception, StackTrace? stackTrace}) → void - Logs a message. Default LogLevel is LogLevel.info. The log is written to the database when the session is closed.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited