Struct steamworks::Server
[−]
[src]
pub struct Server { /* fields omitted */ }
The main entry point into the steam client for servers.
This provides access to all of the steamworks api that servers can use.
Methods
impl Server
[src]
pub fn init(
ip: Ipv4Addr,
steam_port: u16,
game_port: u16,
query_port: u16,
server_mode: ServerMode,
version: &str
) -> SResult<Server>
[src]
ip: Ipv4Addr,
steam_port: u16,
game_port: u16,
query_port: u16,
server_mode: ServerMode,
version: &str
) -> SResult<Server>
Attempts to initialize the steamworks api and returns a server to access the rest of the api.
This should only ever have one instance per a program.
Currently the steamworks api doesn't support IPv6.
Errors
This can fail if:
-
The steam client isn't running
-
The app ID of the game couldn't be determined.
If the game isn't being run through steam this can be provided by placing a
steam_appid.txt
with the ID inside in the current working directory -
The game isn't running on the same user/level as the steam client
-
The user doesn't own a license for the game.
-
The app ID isn't completely set up.
pub fn run_callbacks(&self)
[src]
Runs any currently pending callbacks
This runs all currently pending callbacks on the current thread.
This should be called frequently (e.g. once per a frame) in order to reduce the latency between recieving events.
pub fn register_callback<C, F>(&self, f: F) where
C: Callback,
F: FnMut(C) + 'static + Send + Sync,
[src]
C: Callback,
F: FnMut(C) + 'static + Send + Sync,
Registers the passed function as a callback for the given type.
The callback will be run on the thread that run_callbacks
is called when the event arrives.
pub fn steam_id(&self) -> SteamId
[src]
Returns the steam id of the current server
pub fn authentication_session_ticket(&self) -> (AuthTicket, Vec<u8>)
[src]
Retrieve an authentication session ticket that can be sent to an entity that wishes to verify you.
This ticket should not be reused.
When creating ticket for use by the web API you should wait
for the AuthSessionTicketResponse
event before trying to
use the ticket.
When the multiplayer session terminates you must call
cancel_authentication_ticket
pub fn cancel_authentication_ticket(&self, ticket: AuthTicket)
[src]
Cancels an authentication session ticket received from
authentication_session_ticket
.
This should be called when you are no longer playing with the specified entity.
pub fn begin_authentication_session(
&self,
user: SteamId,
ticket: &[u8]
) -> Result<(), AuthSessionError>
[src]
&self,
user: SteamId,
ticket: &[u8]
) -> Result<(), AuthSessionError>
Authenticate the ticket from the steam ID to make sure it is valid and not reused.
A ValidateAuthTicketResponse
callback will be fired if
the entity goes offline or cancels the ticket.
When the multiplayer session terminates you must call
end_authentication_session
pub fn end_authentication_session(&self, user: SteamId)
[src]
Ends an authentication session that was started with
begin_authentication_session
.
This should be called when you are no longer playing with the specified entity.
pub fn set_product(&self, product: &str)
[src]
Sets the game product identifier.
Used by the master server for version checking. Required field but it will go away eventually.
pub fn set_game_description(&self, desc: &str)
[src]
Sets the game description.
Displayed in the steam server browser (for now). Required field but it will go away eventually.
pub fn set_dedicated_server(&self, dedicated: bool)
[src]
Sets whether this server is dedicated or a listen server.
pub fn log_on_anonymous(&self)
[src]
Login to a generic anonymous account