1.0.1 • Published 7 months ago

rconify v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

rconify

Connect and interact with any Source-compliant server using the Valve RCON Specification

Usage

import {RconClient} from 'rconify'

Example

import {RconClient} from 'rconify'

(async() => {
    // Initialize the client
    const client = new RconClient({
        host: "1.2.3.4", // the IP address to your server
        port: 1234, // RCON server port
        password: "bestpasswordevermade" // RCON server password
    })

    // Connect to the server
    // throws if;
    // - server is not avaliable
    // - password is incorrect
    await client.connect()

    // Send a command
    // Example is using a Minecraft RCON server
    let response = await client.sendCommand("time set day")
    console.log(response) // "Set the time to 1000"

    // Disconnect using the .disconnect() function
    client.disconnect()
})()