A modern RCON client implementation written in ES2015
NOTE: This has only been tested with Minecraft. So be aware of possible bugs with other server implementations. Feel free to submit a PR if you have any problems.
npm install modern-rcon --save
Creates a new Rcon
object.
Connects with the credentials provided in the constructor.
Executes the provided command on the open connection and returns the response.
Disconnects gracefully.
const Rcon = require('modern-rcon');
const rcon = new Rcon('localhost', 'some password');
rcon.connect().then(() => {
return rcon.send('help'); // That's a command for Minecraft
}).then(res => {
console.log(res);
}).then(() => {
return rcon.disconnect();
});
- Install the dependencies with
npm install
- Setup a Minecraft Server for the tests by using
npm run setup-minecraft
Important: This script will automatically accept the Minecraft EULA
To run the tests you need to start the Minecraft Server with npm run start-minecraft
in another Terminal.