docs
Loading...
Searching...
No Matches
CAPI_Session.h

Overview

Storage for a browsing session (cookies, local storage, etc.).

#include <Ultralight/CAPI/CAPI_Session.h>

This class stores data for a unique browsing session (cookies, local storage, application cache, indexed db. etc.). You can create multiple sessions to isolate data between different browsing contexts.

Default Session

The library has a default session named "default" that is used if no session is specified when when creating a View.

Session Lifetime

Sessions can be either temporary (in-memory only) or persistent (backed to disk).

Functions

ULSession ulCreateSession (ULRenderer renderer, bool is_persistent, ULString name)
 Create a Session to store local data in (such as cookies, local storage, application cache, indexed db, etc).
void ulDestroySession (ULSession session)
 Destroy a Session previously created with ulCreateSession().
ULSession ulDefaultSession (ULRenderer renderer)
 Get the default session (persistent session named "default").
bool ulSessionIsPersistent (ULSession session)
 Whether or not is persistent (backed to disk).
ULString ulSessionGetName (ULSession session)
 Unique name identifying the session (used for unique disk path).
unsigned long long ulSessionGetId (ULSession session)
 Unique numeric Id for the session.
ULString ulSessionGetDiskPath (ULSession session)
 The disk path to write to (used by persistent sessions only).

Function Documentation

◆ ulCreateSession()

ULSession ulCreateSession ( ULRenderer renderer,
bool is_persistent,
ULString name )

Create a Session to store local data in (such as cookies, local storage, application cache, indexed db, etc).

Parameters
rendererThe active renderer instance.
is_persistentWhether or not to store the session on disk. Persistent sessions are stored in a subfolder of the config's cache path with this session's name.
nameA unique name for this session.
Returns
Returns a new ULSession instance. You must call ulDestroySession() when finished.
Note
The library doesn't check that names are unique: two persistent sessions with the same name share one folder.

◆ ulDefaultSession()

ULSession ulDefaultSession ( ULRenderer renderer)

Get the default session (persistent session named "default").

Note
This session is owned by the Renderer, you shouldn't destroy it.

◆ ulDestroySession()

void ulDestroySession ( ULSession session)

Destroy a Session previously created with ulCreateSession().

Parameters
sessionThe session instance to destroy (can be NULL).
Warning
Do not destroy the default session returned by ulDefaultSession().

◆ ulSessionGetDiskPath()

ULString ulSessionGetDiskPath ( ULSession session)

The disk path to write to (used by persistent sessions only).

Note
Do not destroy the returned string, it is owned by the Session. This value is reset with every call– if you want to retain it you should copy it via ulCreateStringFromCopy().

◆ ulSessionGetId()

unsigned long long ulSessionGetId ( ULSession session)

Unique numeric Id for the session.

◆ ulSessionGetName()

ULString ulSessionGetName ( ULSession session)

Unique name identifying the session (used for unique disk path).

Note
Do not destroy the returned string, it is owned by the Session. This value is reset with every call– if you want to retain it you should copy it via ulCreateStringFromCopy().

◆ ulSessionIsPersistent()

bool ulSessionIsPersistent ( ULSession session)

Whether or not is persistent (backed to disk).

Go to the source code of this file.