session_start
lib callCapy
function session_start(name : string = "bearer-session", request : capture any) any
Description
session_start() restores the named session or creates one. The browser cookie carries the ID. The runtime stores the values in files under SESSION_PATH.
Call session_set() or session_remove() to change stored fields. These operations update the active session, not just a local map. The runtime saves changed session data at request completion.
Only one session is active in a request. Starting a different name replaces the active session. Start the same name consistently in your session and CSRF calls.
SESSION_TIME uses seconds. Expiry uses the session file modification time. An unchanged session does not refresh that time on each request.
Parameters
request : the caller's request, captured when omitted
name : session cookie name
Return Values
A map with string id, string name, and values, a map of string fields. The call also updates request.session.
Example
Capy
var session := session_start("docs-session")
print(session.id, "\n")