A session is an independent, server-side context for authentication and session variables. Over a stateful WebSocket connection, the Mojo SDK can open several sessions on a single connection and address each one separately.
Note
Opening a session
new_session() attaches a new session and returns a handle scoped to it. The handle exposes use(), query(), set_string(), unset(), begin_transaction(), and close_session().
Attaching and detaching
For lower-level control, attach() returns a session id you can pass to other calls, and detach() releases it.
sessions() lists the active sessions on the connection.
Most calls on the client, including query, create, and the auth methods, accept an optional session argument so you can target a specific session without a handle.