https://github.com/compscidr/krcon
ktolin rcon library
https://github.com/compscidr/krcon
kotlin rcon rust web-rcon
Last synced: 20 days ago
JSON representation
ktolin rcon library
- Host: GitHub
- URL: https://github.com/compscidr/krcon
- Owner: compscidr
- Created: 2025-04-09T17:07:46.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-26T17:08:18.000Z (about 1 year ago)
- Last Synced: 2025-05-04T00:02:21.605Z (about 1 year ago)
- Topics: kotlin, rcon, rust, web-rcon
- Language: Kotlin
- Homepage:
- Size: 324 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# krcon
Kotlin Remote Console library using websockets
## Features
Supports:
- Sending and receiving messages
- Reception of messages using a callback
- Automatic incremental message IDs
## Usage
Add the dependency to your project:
```kotlin
implementation("com.jasonernst.krcon:krcon:0.0.6")
```
```kotlin
fun someCallback(message: WebRConPacket, connection: RConConnection) {
println("Got message: $message from $connection")
}
val connection = RConConnection("localhost", 28017, "somepass")
connection.start(::someCallback)
connection.waitUntilConnected()
connection.send("playerlist")
```
## Example
You can see an example at [src/main/kotlin/com/jasonernst/krcon/KRCon.kt](src/main/kotlin/com/jasonernst/krcon/KRCon.kt).
If you'd like run the example, copy the `local.properties.sample` file to `local.properties` and set the `host`, `port`,
and `password` values to your server's values. Then you can either run directly from the IDE
or run directly with gradle:
```bash
./gradlew run
```
You can also just pass runtime arguments to the main function:
```bash
./gradlew run --args="--host localhost --port 28017 --password somepass"
```
## Demo
