5.2.3 • Published 7 days ago

arcon.js v5.2.3

Weekly downloads
-
License
MIT
Repository
-
Last release
7 days ago

ARCON.js npm.io install size License: MIT Tests

ARCON.js is a lightweight, event-based RCON client for Arma III servers designed to be reliable and easy to use.

Installation

ARCON.js can be installed via npm using npm install arcon.js

Usage

An RCON connection can be established by instantiating the Arcon class and calling the connect function.

Arcon constructor properties

PropertyDescriptiontyperequireddefault
ipThe IP address of the RCON server.stringtrue
portThe port of the RCON server.numbertrue
passwordThe password of the RCON server.stringtrue
autoReconnectWhether to automatically reconnect on disconnects. Excludes incorrect password.boolfalsetrue
playerUpdateIntervalTime (in ms) between sending a players command to the server.numberfalse5000
import { Arcon } from 'arcon.js';

const connection = new Arcon({
  ip: '127.0.0.1',
  port: 2312,
  password: '12345'
});

connection.connect();

Events

Being an event-based library, there are multiple events that you can subscribe to. A list of all events can be found here. Note that if you do not add a listener to the error event, your application will crash if an error is ever created.

import { Arcon, Player, BeLog } from 'arcon.js';

const connection = new Arcon({
  ip: '127.0.0.1',
  port: 2312,
  password: '12345'
});

connection.on('connected', () => {
  console.log('Connected!');
});

connection.on('disconnected', () => {
  console.log('Disconnected!');
});

connection.on('error', (error: Error) => {
  console.error(error);
});

connection.on('players', (players: Player[]) => {
  console.log(players);
});

connection.on('playerConnected', (player: Player) => {
  console.log(player);
});

connection.on('playerDisconnected', (player: Player, reason: string) => {
  // If a player disconnects by themself, reason is "disconnected".
  // Otherwise it will be parsed from text.
  console.log(player, reason);
});

connection.on(
  'playerUpdated',
  (player: Player, [pingUpdate, verifiedUpdate, lobbyUpdate]: [boolean, boolean, boolean]) => {
    if (pingUpdate) console.log(player.ping);
  }
);

connection.on('beLog', (log: BeLog) => {
  console.log(log);
});

connection.on('playerMessage', (player: Player, channel: string, message: string) => {
  console.log(`(${channel}) ${player.name}: ${message}`);
});

connection.on('adminMessage', (id: number, channel: string, message: string) => {
  console.log(id, channel, message);
});

connection.connect();
5.2.3

7 days ago

5.2.2

7 days ago

5.2.1

9 days ago

5.1.1

1 month ago

5.1.0

1 month ago

5.2.0

1 month ago

5.0.2

1 month ago

5.0.1

1 month ago

5.0.0

1 month ago

3.0.0-alpha.22

2 months ago

3.0.0-alpha.21

8 months ago

3.0.0-alpha.19

1 year ago

3.0.0-alpha.20

12 months ago

3.0.0-alpha.18

1 year ago

3.0.0-alpha.16

1 year ago

3.0.0-alpha.17

1 year ago

3.0.0-alpha.14

1 year ago

3.0.0-alpha.15

1 year ago

3.0.0-alpha.7

1 year ago

3.0.0-alpha.6

1 year ago

3.0.0-alpha.9

1 year ago

3.0.0-alpha.8

1 year ago

3.0.0-alpha.13

1 year ago

3.0.0-alpha.1

1 year ago

3.0.0-alpha.3

1 year ago

3.0.0-alpha.2

1 year ago

3.0.0-alpha.5

1 year ago

3.0.0-alpha.4

1 year ago

3.0.0-alpha.10

1 year ago

3.0.0-alpha.12

1 year ago

3.0.0-alpha.11

1 year ago

2.0.28

2 years ago

2.0.29

2 years ago

2.1.1

1 year ago

2.0.33

1 year ago

2.0.34

1 year ago

2.0.31

1 year ago

2.0.32

1 year ago

2.0.30

1 year ago

2.1.0

1 year ago

2.0.19

2 years ago

2.0.26

2 years ago

2.0.27

2 years ago

2.0.24

2 years ago

2.0.25

2 years ago

2.0.22

2 years ago

2.0.23

2 years ago

2.0.20

2 years ago

2.0.21

2 years ago

2.0.15

2 years ago

2.0.3

2 years ago

2.0.16

2 years ago

2.0.2

2 years ago

2.0.13

2 years ago

2.0.5

2 years ago

2.0.14

2 years ago

2.0.4

2 years ago

2.0.11

2 years ago

2.0.7

2 years ago

2.0.12

2 years ago

2.0.6

2 years ago

2.0.9

2 years ago

2.0.8

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

2.0.17

2 years ago

1.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago