Query for the status of any game server in Node.JS
node-GameDig is a game server query library, capable of querying for the status of nearly any game or voice server. If a server makes its status publically available, GameDig can fetch it for you.
GameDig is available as a node.js module, as well as a command line executable.
npm install gamedig
var Gamedig = ;Gamedig;
Is NPM out of date? If you're feeling lucky, you can install the latest code withnpm install sonicsnes/node-gamedig
The callback function is "guaranteed" to be called exactly once.
If an error occurs, the returned object will contain an "error" key, indicating the issue. If the error key exists, it should be assumed that the game server is offline or unreachable.
Otherwise, the returned object is guaranteed to contain the following keys:
Stable, always present:
Unstable, not guaranteed:
It can usually be assumed that the number of players online is equal to the length of the players array. Some servers may return an additional player count number, which may be present in the unstable raw object.
Want support for one of these games? Please open an issue to show your interest! Know how to code? Protocols for most of the games above are documented in the /reference folder, ready for you to develop into GameDig!
Don't see your game listed here?
First, let us know so we can fix it. Then, you can try using some common query protocols directly by using one of these server types:
To receive a full player list response from CS:GO servers, the server must have set the cvar: host_players_show 2
DayZ uses a query port that is separate from its main game port. The query port is usually the game port PLUS 24714 or 24715. You may need to pass this port in as the 'port_query' request option.
Some minecraft servers may not respond to a typical status query. If this is the case, try using the 'minecraftping' server type instead, which uses a less accurate but more reliable solution.
For full query results from Mumble, you must be running the GTmurmur plugin. If you do not wish to run the plugin, or do not require details such as channel and user lists, you can use the 'mumbleping' server type instead, which uses a less accurate but more reliable solution
The server must have xmlrpc enabled, and you must pass the xmlrpc port to GameDig, not the connection port. You must have a user account on the server with access level User or higher. Pass the login into to GameDig with the additional options: login, password
For teamspeak 3 queries to work correctly, the following permissions must be available for the guest server group:
Requires tshock server mod, and a REST user token, which can be passed to GameDig with the additional option: token
Games with this note use a query port which is usually not the same as the game's connection port. Usually, no action will be required from you. The 'port' option you pass GameDig should be the game's connection port. GameDig will attempt to calculate the query port automatically. If the query still fails, you may need to pass the 'port_query' option to GameDig as well, indicating the separate query port.
Want to integrate server queries from a batch script or other programming language? You'll still need npm to install gamedig:
npm install gamedig -g
After installing gamedig globally, you can call gamedig via the command line using the same parameters mentioned in the API above:
gamedig --type minecraft --host mc.example.com --port 11234
The output of the command will be in JSON format.