Skip to content

Fixed example and readme to reflect how the library actually works #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions example.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
var srcds = require('./main.js');

srcds.init();

srcds.client.on('decoded', function(info) {
console.log(info);
srcds.client.close();
});

// If the example isn't working, it might just be that the server it's trying to query is down. You can cross check that here:
// http://www.gametracker.com/server_info/203.217.24.85:27017/
// If it is down, find one that isn't and change the IP and port accordingly
srcds.info('203.217.24.85', 27017, function(err) {
if (err) console.error(err)
var client = srcds("27.50.71.3", 21035);


client.info(function(err, res) {
if (err) console.error(err);
console.log("Queried server at " + res.ip + ":" + res.port
+ ". Its name is '" + res.serverName + "' and it has "
+ res.numPlayers + " people currently playing.");
});
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var srcds = require('srcds-info');

client = srcds('27.50.71.3', 21045);

client.info('203.217.24.85', 27017, function(err, info) {
client.info(function(err, info) {
if (err) {
console.error(err)
}
Expand Down