Documentation

Multiplayer Services SDK

Multiplayer Services SDK

Session hosts, clients, and servers

Understand how session handles change the permissions and capabilities available to hosts, clients, and servers.
Read time 2 minutesLast updated a day ago

Each session can be accessed through different handles, and each handle exposes the permissions and operations available to that role.

Hosts, clients, and servers

You access a session through one of three handles. Each handle is the same session viewed with a different level of authority:

Handle

Who uses it

How you get it

What it allows

ISession
Every member of the session, including the host.Returned by create, join, and reconnect calls.Read session data, manage your own player properties, leave, refresh, and reconnect.
IHostSession
The player who is currently the session host.Call
session.AsHost()
.
Everything
ISession
allows, plus host-only operations.
IServerSession
A dedicated server or other service-owned process that manages the session.Returned by
MultiplayerServerService.Instance.CreateSessionAsync
, or by calling
session.AsServer()
.
Everything
IHostSession
allows, with server-level authority.
AsHost()
and
AsServer()
don't convert the session or change its state. They check the role of the caller and return a handle that exposes the operations that role is allowed to perform. If the caller doesn't have that role, the call throws a
SessionException
with the
Forbidden
error. Use
session.IsHost
and
session.IsServer
to check the role before you call them.
These handles are the client-side view of the session's permission model. The service enforces the same rules on the data itself. For the rules about who can read and write each type of data, refer to the data access table in Session data and player data.

Servers aren't players

When a dedicated server manages a session, the server holds an
IServerSession
handle with host-level authority, but it isn't a member of the session's player list.
session.IsServer
is
true
on the server. For more information, refer to Game server hosting support.