UNPKG

rcon-ts-valve

Version:

Improved RCON client in typescript

50 lines (36 loc) 1.51 kB
# rcon-ts-valve This package is a simple rcon client written in typescript. This package is based on the [rcon-ts](https://github.com/electricessence/rcon-ts/tree/master) package, add the feature that support Multiple-packet Responses. Multiple-packet Responses support is under the guide of [Valve's Source RCON Protocol](https://developer.valvesoftware.com/wiki/Source_RCON_Protocol#Multiple-packet_Responses). ## Why use rcon-ts-valve? After searching for a rcon client for node.js expecially for TypeScript, I found that every packages either didn't work or didn't have the features I needed(especially when server need to send data that is more than 4096 bytes). And this package is very slim and easy to use which can reduce the load on your server when building web panels using this package. ## Installation ```bash npm install rcon-ts-valve ``` ## Basic Usage ```typescript import Rcon from 'rcon-ts-valve' (async () => { const rcon = new Rcon({ host: "127.0.0.1", port: 27555, password: "password", }); try { // initial connection await rcon.connect(); // Basic usage const response = await rcon.send('Command0'); console.log(response); // Sequential usage const responseList = await rcon.sequentialSend(["Command1", "Command2", "Command3", "..."]); console.log(responseList); }catch (e) { console.log("Error", e); }finally { rcon.disconnect(); } })() ```