box_session.rst 2.55 KiB
Package box.session
The box.session
package allows querying the session state, writing to a
session-specific temporary Lua table, or setting up triggers which will fire
when a session starts or ends. A session is an object associated with each
client connection.
Example
tarantool> box.session.peer(session.id())
---
- 127.0.0.1:45129
...
tarantool> box.session.storage.random_memorandum = "Don't forget the eggs."
---
...
tarantool> box.session.storage.radius_of_mars = 3396
---
...
tarantool> m = ''
---
...
tarantool> for k, v in pairs(box.session.storage) do m=m..k..'='..v..' ' end
---
...
tarantool> m
---
- 'radius_of_mars=3396 random_memorandum=Don''t forget the eggs. '
...
See the section Triggers on connect and disconnect for instructions
about defining triggers for connect and disconnect events with
box.session.on_connect()
and box.session.on_disconnect()
. See
the section Authentication and access control for instructions about
box.session
functions that affect user identification and security.