Host a masterlist

From Vice City Multiplayer
Revision as of 15:20, 18 April 2015 by Ysc3839 (talk | contribs) (Created page with "In order to host a masterlist, you'll need a database to store servers that are online, and a method of verifying that these servers are actually online, such as querying serv...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing

In order to host a masterlist, you'll need a database to store servers that are online, and a method of verifying that these servers are actually online, such as querying servers as they announce themselves.

These are the accepted endpoints for the masterlist: /announce.php Endpoint for servers to announce their existence to the masterlist. From here, the masterlist takes the information provided by the server to determine if it is online, if it is of the right version (0.4), and other factors such as if it has been banned from announcing.

Parameters port (POST) - the port that the server is listening on; provided by the server and expected to exist The IP address is implicitly provided as the IP address the HTTP request came from.

Expected Output HTTP code of 200 OK if the masterlist approves the server. No other output is expected or parsed.

Errors 400 Bad Request if:

  • The announcing server does not specify a port.
  • The server uses a bad magic code (other than VCMP).
  • The server responds to the masterlist query, but the IP or port in the query response does not match the server making the masterlist query.

403 Forbidden if the user agent of the querying server is not VCMP/0.4. 405 Method Not Allowed if the server uses GET instead of POST for the port request. 408 Request Timeout if the masterlist timed out trying to query the VC:MP server. 500 Internal Server Error if any other error occurs trying to add the server to the masterlist.


/servers Endpoint for the browser to retrieve a list of servers, in JSON format.

Parameters None.

Expected Output A JSON object with a "success" field set to true and a "servers" field with an array of objects containing "ip", "port", and "is_official" fields.

Example:

{
    "success": true,
    "servers": [
        {
            "ip":"127.0.0.1",
            "port":8192,
            "is_official":false
        }
    ]
}

Errors A JSON object with a "success" field set to false, an "errorCode" field with a numeric error code, and an "error" field with a string representation of the error.

Example:

{
    "success": false,
    "errorCode": 2,
    "error": "Failed to query the masterlist database"
}

/official Identical to /servers, except it only retrieves a list of servers marked as official.


http://forum.vc-mp.org/?topic=266.msg1530#msg1530