ktor-server-core / io.ktor.sessions / SessionTracker

SessionTracker

interface SessionTracker<S : Any>

SessionTracker provides ability to track and extract session from the call context.

Functions

clear

abstract suspend fun clear(call: ApplicationCall): Unit

Clear session information

load

abstract suspend fun load(call: ApplicationCall, transport: String?): S?

Load session value from transport string for the specified call

store

abstract suspend fun store(call: ApplicationCall, value: S): String

Store session value and return respective transport string for the specified call.

validate

abstract fun validate(value: S): Unit

Validate session information

Inheritors

SessionTrackerById

class SessionTrackerById<S : Any> : SessionTracker<S>

SessionTracker that transfers a Session Id generated by a sessionIdProvider in HTTP Headers/Cookies. It uses a storage and a serializer to store/load serialized/deserialized session content of a specific type.

SessionTrackerByValue

class SessionTrackerByValue<S : Any> : SessionTracker<S>

SessionTracker that stores the contents of the session as part of HTTP Cookies/Headers. It uses a specific serializer to serialize and deserialize objects of type type.