Session¶
Runnable example
python/examples/session_inspect.py — read the current session's settings, connected users, and permission roles (read-only).
resoio.session.SessionClient ¶
Bases: _BaseClient[SessionStub]
Async client for the Resonite IO Session service over a UDS.
Use as an async context manager so the gRPC channel closes deterministically.
Targeting (kick / ban / silence / respawn / role):
pass local=True to target yourself, otherwise user_id is tried
first and user_name is the fallback. user_name resolution
fails if several connected users share the name -- prefer user_id
for guests. Moderation and settings writes are host-gated: calling them
without host permission raises gRPC PermissionDenied.
Source code in src/resoio/_client.py
get_settings
async
¶
Return the current session settings snapshot.
apply_settings
async
¶
apply_settings(
*,
world_name: str | None = None,
world_description: str | None = None,
max_users: int | None = None,
access_level: SessionAccessLevel | None = None,
hide_from_listing: bool | None = None,
mobile_friendly: bool | None = None,
away_kick_enabled: bool | None = None,
away_kick_minutes: float | None = None,
auto_save_enabled: bool | None = None,
auto_save_interval_minutes: float | None = None,
auto_cleanup_enabled: bool | None = None,
auto_cleanup_interval_seconds: float | None = None,
tags: Sequence[str] | None = None,
) -> None
Patch the session settings; None kwargs are left unchanged.
Scalar / bool / string fields ride on the proto3 optional
presence flag, so a None kwarg is simply not put on the wire.
access_level=None sends the UNSPECIFIED sentinel ("leave
unchanged"); a concrete value sets it. tags is replace-all: pass
a sequence to replace the tag set (empty clears it) or None to
leave the tags untouched.
Returns None by contract: the engine applies settings on its own
thread, so a post-apply snapshot is not reliable in the same RPC.
Call :meth:get_settings afterwards if you need the new state.
Source code in src/resoio/session.py
list_users
async
¶
List the users connected to the current session.
Source code in src/resoio/session.py
kick_user
async
¶
kick_user(
*,
user_id: str = "",
user_name: str = "",
local: bool = False,
kind: KickKind = KickKind.KICK_AND_REVOKE,
) -> None
Kick a user from the session.
Source code in src/resoio/session.py
ban_user
async
¶
Ban a user from the session.
Source code in src/resoio/session.py
silence_user
async
¶
silence_user(
*,
user_id: str = "",
user_name: str = "",
local: bool = False,
silenced: bool = True,
) -> SessionUser
Silence (or unsilence) a user; returns the updated snapshot.
Source code in src/resoio/session.py
respawn_user
async
¶
Respawn a user.
With no target the engine respawns the local user.
Source code in src/resoio/session.py
respawn_self
async
¶
set_user_role
async
¶
set_user_role(
role_name: str, *, user_id: str = "", user_name: str = "", local: bool = False
) -> SessionUser
Assign role_name to a user; returns the updated snapshot.
Source code in src/resoio/session.py
list_roles
async
¶
List the session's permission roles and default-role assignments.
get_user_role_overrides
async
¶
List the per-user default-role overrides
(DefaultUserPermissions).
Source code in src/resoio/session.py
resoio.session.SessionSettings
dataclass
¶
SessionSettings(
world_name: str,
world_description: str,
max_users: int,
access_level: SessionAccessLevel,
hide_from_listing: bool,
mobile_friendly: bool,
away_kick_enabled: bool,
away_kick_minutes: float,
auto_save_enabled: bool,
auto_save_interval_minutes: float,
auto_cleanup_enabled: bool,
auto_cleanup_interval_seconds: float,
tags: tuple[str, ...],
session_id: str,
is_host: bool,
)
Snapshot of the current session settings (Settings tab).
session_id / is_host are read-only metadata; the rest mirror
the engine WorldConfiguration.
resoio.session.SessionUser
dataclass
¶
SessionUser(
user_id: str,
user_name: str,
is_host: bool,
is_local_user: bool,
is_present_in_world: bool,
is_silenced: bool,
local_volume: float,
role_name: str,
platform: str,
head_device: str,
)
One connected user (Users tab).
resoio.session.SessionRole
dataclass
¶
One permission role (Permissions tab).
resoio.session.SessionRoles
dataclass
¶
SessionRoles(
roles: tuple[SessionRole, ...],
default_anonymous_role: str,
default_visitor_role: str,
default_contact_role: str,
default_host_role: str,
default_owner_role: str,
)
The session's permission roles plus the default-role assignments.
resoio.session.UserRoleOverride
dataclass
¶
One DefaultUserPermissions entry (user id -> role name).
resoio.session.SessionAccessLevel ¶
Bases: Enum
Session access level (mirrors SkyFrost.Base.SessionAccessLevel).
The wire UNSPECIFIED sentinel ("leave unchanged" on
:meth:SessionClient.apply_settings) is deliberately omitted; use
access_level=None for that.
resoio.session.KickKind ¶
Bases: Enum
Kick variant (mirrors the engine KickRequestState).