steam_rcon 1.0.4
steam_rcon: ^1.0.4 copied to clipboard
Dart implementation of the Source RCON protocol for communicating with game servers. Supports authentication, command sending, automatic reconnection, and network monitoring.
๐ README.md #
# Steam RCON ๐ฎ
A Dart implementation of the Source RCON protocol for communicating with game servers such as those based on Source Engine or Palworld.
Supports:
โ
Authentication
โ
Sending RCON commands
โ
Automatic reconnection on network loss
โ
Live network monitoring with connectivity_plus
โ
Command retry on disconnect
---
## ๐ Getting Started
### ๐ฆ Installation
Add the following to your `pubspec.yaml`:
```yaml
dependencies:
steam-rcon: ^1.0.4
Or use a local path during development:
dependencies:
rcon:
path: ../steam-rcon
Then run:
dart pub get
๐ Basic Usage #
import 'package:steam-rcon/rcon.dart';
void main() async {
final client = RconClient('127.0.0.1', port: 25575);
await client.connect();
final authenticated = await client.authenticate('your_rcon_password');
if (!authenticated) {
print('โ Authentication failed');
return;
}
final response = await client.sendCommand('status');
print('๐ก Server response: $response');
client.disconnect();
}
๐ก Features #
- Handles full Source RCON protocol (ID, type, null-terminated strings)
- Automatic reconnect if connection drops
- Auto-resend of last command after reconnection
- Network change detection with
connectivity_plus - Typed packet decoding and encoding
- Easy-to-use API for Flutter or Dart CLI
๐ Project Structure #
rcon_client.dart: Manages connection, authentication, reconnection and command sending.rcon_packet.dart: Handles packet encoding/decoding according to the Valve Source RCON protocol.
๐ Example: Using in Flutter #
You can use this in a Flutter app to build an RCON admin panel. For example:
final rcon = RconClient("192.168.0.100", port: 25575);
await rcon.connect();
await rcon.authenticate("your_password");
final players = await rcon.sendCommand("ShowPlayers");
print(players);
๐ License #
BSD 3-clause ยฉ Matthias Prรถll
โค๏ธ Contributing #
Pull requests are welcome! If you want to help improve the package, feel free to fork it and send a PR.