Skip to main content

ServerAccess

A class in Alta.Api.Client, Alta.Api.Client.HighLevel.

A server's session with Alta's web API: start, ping, online players and stop. Server side; returned by ServerApiClient for a positive server ID. Every call goes to the API, which no longer answers.

Constructors​

1 private and internal constructor
MemberWhat it is
internal ServerAccess(GameServerInfo info, IHighLevelApiClientManager apiClient)Creates a ServerAccess from info and apiClient.

Fields​

4 private and internal fields
MemberWhat it is
private readonly IHighLevelApiClientManager apiClientThe client manager requests are sent through.
private bool isRunningLocallyWhether the server started as a local server, which picks the stop call.
private int? serverSessionBacking field for ServerSession.
private GameServerInfo templateServerCached template server info.

Properties​

MemberWhat it is
bool IsActive { get; set; }When false, start, ping, player updates and stop skip the API. Set false after stopping.
GameServerInfo ServerInfo { get; }The server's info from the API.
int? ServerSession { get; }The session ID the API gave on start, null before start or after stop.

Methods​

MemberWhat it is
async Task<GameServerInfo> GetTemplateServer()For a world-owned server, fetches and caches the owner's template server info. Otherwise null.
Task Ping()Pings the session on the API while active.
async Task SetOnlinePlayersAsync(IEnumerable<UserInfo> onlinePlayers)Stores the online players and sends them to the API, once a session exists and while active.
async Task StartAsync(ServerStartArguments startupArgs)Starts a session on the API, as a local or hosted server depending on the start arguments.
async Task StopAsync(ShutdownReason endReason)Ends the session with a shutdown reason and marks the access inactive.