Simple, painless node RCON client for Source servers
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib no timeout now possible Jul 14, 2016
test
.editorconfig
.gitignore
.npmignore
.travis.yml
LICENSE.md added a license to shut npm the hell up Aug 2, 2015
README.md
index.js
package.json

README.md

simple-rcon

Build Status Coverage Status

Dependency Status devDependency Status

Simple, painless node RCON client for Source servers.

Install
npm install simple-rcon
Examples
var Rcon = require('simple-rcon');
var client = new Rcon({
  host: '127.0.0.1',
  port: '27015',
  password: 'rconPassword'
}).exec('changelevel cp_badlands', function() {
  client.exec('say \'hey look the map changed!\'');
}).exec('status', function(res) {
  console.log('Server status', res.body);
}).exec('sm_kick somebody', function() {
  client.close();
}).connect();

client.on('authenticated', function() {
  console.log('Authenticated!');
}).on('connected', function() {
  console.log('Connected!');
}).on('disconnected', function() {
  console.log('Disconnected!');
});
API
  • new Rcon([options]):

    • options.host: string containing host address (default '127.0.0.1')
    • options.port: int for server port number (default 27015)
    • options.password: string containing rcon password
    • options.timeout: int for socket timeout (default 5000ms)
  • exec(command, callback): Sends rcon commands to server. If exec is called before the authenticated event is triggered, the commands will be buffered. Upon authentication, all commands will be executed in order.

    • command - String containing remote command
    • callback - Function with signature function(res) {}
  • close(): Closes connection

Events
  • connecting Client connecting to server.
  • connected Client connected to server, although not authenticated.
  • authenticated Client authenticated successfully with rcon password.
  • error Connection interrupted by an error. Event callback accepts a single err argument.
  • disconnecting Connecting is about to close.
  • disconnected Connection has been closed, interrupted, or dropped.
Contributors
Further Reading

Read more about the RCON Protocol

License

MIT