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.
Installation
npm install modern-rcon --save
API
new Rcon(host, port = 25575, password, timeout = 5000)
Creates a new Rcon
object.
rcon.connect()
-> Promise
Connects with the credentials provided in the constructor.
rcon.send(data)
-> Promise<string>
Executes the provided command on the open connection and returns the response.
rcon.disconnect()
-> Promise
Disconnects gracefully.
Example
const Rcon = ; const rcon = 'localhost' 'some password'; rcon;
Contribute
- 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.