Skip to content

Session

Class: jstp.Session

JSTP session class is used to buffer and resend the messages in case of unexpected connection closes. It extends Map class and thus can be used to store the current session state independently of connection.

session.id

UUID v4 identifier of the session.

session.connection

Link to the connection that is currently used in this session.

session.username

The username that was used to log in for the first time in the session or null if 'anonymous' authentication strategy was used.

session.toString()

Converts Session object to string.

Must be used by implementers of session storage providers when exporting the Session objects.

It is possible to lose some data due to this method using JSON for serialization.

Session.fromString(sessionString)

Static method that restores Session object from string created by toString() method.

Must be used by implementers of session storage providers when importing the Session objects.