Documentation

Get server status

The function to get the server info is aos_server_status and the value is
a string of the server identifier, which is used by the AoS client to connect.
It can contain the version info, however it doesn't use it as part of checking the status.
It uses the BuildandShoot servers by default, but it can be configured with any status server if you want
by using the second parameter to specify the URL with your own data, if needed.

The function can return undefined if the server is offline or not found, so handle accordingly.
The code below just shows how to use the function visually, how to implement it in your
own page is entirely up to you since every case is unique.

                    // Below example uses BuildandShoot's server list - which is what the script uses by default
                    let data = await aos_server_status("aos://2791176354:43887:0.75") // returns the server's data

                    // below is an example on how to use a custom list
                    // let data = await aos_server_status("aos://2791176354:43887:0.75", "https://list.example.com")

                    if (data) {
                        // Below is all the important data points, but is not all provided
                        // by the BuildandShoot API.
                        let server_name = data.name
                        let server_players_current = data.players_current
                        let server_players_max = data.players_max
                        let server_map = data.map
                        let server_ping = data.latency
                        let server_mode = data.game_mode
                        let server_country = data.country
                    }