Skip to content

Class: RconService ​

RCON service: remotely run a command on a game server (Minecraft, Source servers, etc.) from an app. The call is relayed by the Kappapps backend.

Remarks ​

Accessible everywhere via k.rcon. You never have to instantiate this service yourself — it is created by the SDK when the app/widget starts.

Example ​

ts
// Make it rain on a Minecraft server when the !rain command is used
k.chat.onCommand('rain', async () => {
    await k.rcon.send('mc.example.com', 25575, 'myPassword', 'weather rain');
});

Implements ​

Methods ​

send() ​

ts
send(
   host, 
   port, 
   password, 
command): Promise<any>;

Sends an RCON command to the specified game server and returns its response.

Parameters ​

host ​

string

Host of the RCON server (domain name or IP).

port ​

number

RCON port of the server.

password ​

string

RCON password of the server.

command ​

string

The command to run on the server.

Returns ​

Promise<any>

The game server's response to the command.

Example ​

ts
const response = await k.rcon.send('mc.example.com', 25575, 'myPassword', 'say Hello');