View Source A2S.Client (elixir_a2s v0.4.3)
An easy to use client that performs the packet assembly necessary to execute A2S queries.
This client handles requests concurrently and should be suitable for most general uses.
Note: must supply a :name
.
Summary
Functions
Returns a specification to start this module under a supervisor.
Query a game server running at address
for the data specified by query
.
The following configuration options are available
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec query( :info | :players | :rules, {:inet.ip_address(), :inet.port_number()}, [{atom(), any()}] ) :: {:info, A2S.Info.t()} | {:players, A2S.Players.t()} | {:rules, A2S.Rules.t()} | {:error, any()}
Query a game server running at address
for the data specified by query
.
Additional options are available as a keyword list:
:name
- Alias of the top-level supervisor. Defaults toA2S.Client
.:timeout
- Absolute timeout for the request to complete. Defaults to5000
or 5 seconds.
The following configuration options are available:
:name
- Alias of the top-level supervisor. Can be provided if you intend to run multiple client instances. Defaults toA2S_Singleton
.:port
- UDP socket port used for querying game servers. Defaults to20850
.:idle_timeout
-A2S.Client
internally allocates a:gen_statem
for each address queried, that should exit after idling to keep from leaking resources. Defaults to120_000
or 2 minutes.:recv_timeout
- Timeout the:gen_statem
's will wait between receiving individual packets before returning{:error, :recv_timeout}
. Defaults to3000
or 3 seconds.