rcon-client is a JavaScript/TypeScript library designed to connect to and interact with Minecraft servers via the RCON protocol. Its key differentiator is a built-in packet queue that limits pending requests, which is particularly useful for sending multiple commands concurrently without overwhelming the server. The library supports persistent connections, allowing an Rcon instance to connect and disconnect multiple times. It leverages async/await patterns for network operations and ships with TypeScript types, making it suitable for modern JavaScript and TypeScript projects. The current stable version is 4.2.5. However, it's explicitly stated by the maintainer that the library has not been actively maintained for a while, implying an infrequent release cadence and potential for unaddressed issues. Developers should consider this lack of maintenance when choosing this library for new projects. It uses Node.js's EventEmitter internally for connection lifecycle events.
npm install rcon-clientVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to establish an RCON connection using the static `connect` method, send a single command, execute multiple commands concurrently using `Promise.all`, and properly close the connection. It includes basic error handling and uses environment variables for sensitive connection details.
For new projects, evaluate more actively maintained RCON client libraries. If already using, be aware of potential unaddressed issues and consider contributing to the project or forking it if critical updates are needed.
Use the `connect()` method before `send()`, and consider implementing an auto-reconnect logic using the exposed events (`connect`, `end`, `error`) if your application requires resilient connections. The `connect` method can be called multiple times on the same instance after calling `end`.
Always use `await` before `Rcon.connect(...)` and `rcon.send(...)`. Wrap asynchronous calls in a `try...catch` block to gracefully handle potential connection or command execution errors.
Ensure `await rcon.connect()` completes successfully before calling `rcon.send()`. If using the static `Rcon.connect()`, ensure you `await` its result. Check connection status via events (`connect`, `end`, `error`) if managing connection state manually.
Verify the RCON password configured on your Minecraft server and ensure it matches the `password` field in your `Rcon.connect()` options. Double-check for typos or leading/trailing spaces.
1. Ensure your Minecraft server is running. 2. Verify that RCON is enabled in your server's `server.properties` (`enable-rcon=true`). 3. Check the `rcon.port` and `rcon.password` in `server.properties`. 4. Confirm no firewall (OS or network) is blocking connections to the RCON port on the server host. 5. Double-check the `host` and `port` values in your `Rcon.connect()` call.
No dependency data recorded yet.