# simple-rcon

> a simple rcon client

Latest version **0.3.1** (published 2016-07-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install simple-rcon
pnpm add simple-rcon
yarn add simple-rcon
bun add simple-rcon
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2016-07-14 |
| First published | 2013-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Preston Pham |
| Maintainers | preston |

## Links

- npm: https://www.npmjs.com/package/simple-rcon
- Repository: https://github.com/prestonp/simple-rcon
- Homepage: https://github.com/prestonp/simple-rcon#readme
- Issues: https://github.com/prestonp/simple-rcon/issues
- npm.io page: https://npm.io/package/simple-rcon

## Recent versions

- 0.3.1 (latest) — 2016-07-14
- 0.3.0 — 2015-08-23
- 0.2.1 — 2013-02-20
- 0.1.3 — 2013-02-13
- 0.1.2 — 2013-02-06
- 0.1.1 — 2013-02-06

## README

# simple-rcon

[![Build Status](https://travis-ci.org/prestonp/simple-rcon.svg?branch=master)](https://travis-ci.org/prestonp/simple-rcon)
[![Coverage Status](https://coveralls.io/repos/prestonp/simple-rcon/badge.svg?branch=master&service=github)](https://coveralls.io/github/prestonp/simple-rcon?branch=master)

[![Dependency Status](https://david-dm.org/prestonp/simple-rcon.svg)](https://david-dm.org/prestonp/simple-rcon)
[![devDependency Status](https://david-dm.org/prestonp/simple-rcon/dev-status.svg)](https://david-dm.org/prestonp/simple-rcon#info=devDependencies)

Simple, painless node RCON client for Source servers.

##### Install

```
npm install simple-rcon
```

##### Examples

```js
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

* [Ant Cosentino (skibz)](https://github.com/skibz)
* [whitebird](https://github.com/whitebird)

##### Further Reading
Read more about the [RCON Protocol](https://developer.valvesoftware.com/wiki/Source_RCON_Protocol)

##### License

MIT

---
_Source: https://npm.io/package/simple-rcon · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
