Skip to content

Instantly share code, notes, and snippets.

@SomeBottle
Last active September 6, 2022 09:50
Show Gist options
  • Save SomeBottle/b644a2b6ad585e33d35e10f5e2b497c5 to your computer and use it in GitHub Desktop.
Save SomeBottle/b644a2b6ad585e33d35e10f5e2b497c5 to your computer and use it in GitHub Desktop.
RCON TEST
const Rcon = require('rcon');
var conn = new Rcon('127.0.0.1', 25575, '123456');
conn.on('auth', function () {
// You must wait until this event is fired before sending any commands,
// otherwise those commands will fail.
console.log("Authenticated");
console.log("Sending command: help")
conn.send("help");
}).on('response', function (str) {
console.log("Response: " + str);
}).on('error', function (err) {
console.log("Error: " + err);
}).on('end', function () {
console.log("Connection closed");
process.exit();
});
conn.connect();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment