0.3.1 • Published 10 years ago

simple-rcon v0.3.1

Weekly downloads
22
License
MIT
Repository
github
Last release
10 years ago

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

0.3.1

10 years ago

0.3.0

11 years ago

0.2.1

13 years ago

0.1.3

13 years ago

0.1.2

13 years ago

0.1.1

13 years ago