The easiest way to get it is via [npm]
npm install steam-server-status
If you want to run the latest version (i.e. later than the version available via [npm]) you can clone this repo, then use [npm] to link-install it:
npm link /path/to/your/clone
Of course, you can just clone this, and manually point at the library itself, but I really recommend using [npm]!
The library provides basic functionality for requesting the status and statistics of a steam source engine game. The simplest use case you just make a call like this:
var steamServerStatus = require(steam-server-status');
steamServerStatus.getServerStatus(
'tf.bonta-kun.net', 27015, function(serverInfo) {
if (serverInfo.error) {
console.log(serverInfo.error);
} else {
console.log("game: " + serverInfo.gameName);
console.log("server name: " + serverInfo.serverName);
console.log("players: " + serverInfo.numberOfPlayers + "/" + serverInfo.maxNumberOfPlayers)
}
});
This will connect to a server and split out ot the logs what game the server is playing, what the server name is listed as and how many people are playing on it.
This object hems very closely to the Valve's response format documentation.
This is used to check if there was an error talking to the server, it will be undefined if there were no problems, if it's populated it'll be a error message.
Version, as far as I can tell it's always 49.
This is what the server's name is listed as. It corresponds to the hostname attribute in server.cfg, but is not a network hostname.
Current map.
Game directory, can be used to determine what game is being played.
A nicer representation of the game name, extracted from the value for gameDirectory.
The game description returned by the server, it's generally slightly less than acurate.
Steam application id. See this page if you're interested in learning more.
Current number of players on teh server.
Maximum (visible) number of players.
Number of bots currently running around on ther server.
If the server is a dedicated server or not.
Host operating system of the server. 'l' for Linux, 'w' for Windows.
Boolean to say if the server requires a password.
Boolean to say whether is VAC secured or not.
Current version of the game the server is running.
This is just echoed back from the request.
This is just echoed back from the request.