Rust client and parser for Rocket League Stats API event streams over TCP, with optional Python bindings via PyO3.
- TCP client with reconnect support for Rocket League Stats API events.
- Typed event parsing (
StatsEvent) with support for unknown/forward-compatible events. - Event filtering and player/match tracking helpers (
EventFilter,PlayerTracker,MatchSignal). - Config helpers for optional Stats API INI handling.
- CLI binaries for raw, compact tick, and pretty filtered output.
- SOS relay binary that translates RL events to SOS-style websocket events.
- Optional Python extension module (
rlstatsapi) behind thepythonCargo feature. - Example Python library in
examples/python_library.
- Rust toolchain (stable).
- Python 3.11+ (only needed for Python bindings and examples).
- Rocket League Stats API exporter enabled and sending to
127.0.0.1:49123(default).
cargo build
cargo testcargo run --bin raw_eventsOptional INI path:
cargo run --bin raw_events -- --ini /path/to/DefaultStatsAPI.inicargo run --bin tick_listenercargo run --bin rl_events -- --help
cargo run --bin rl_events -- --list-events
cargo run --bin rl_events -- --event goalcargo run --bin player_boardcargo run --bin sos_relaySend translated SOS events to a custom overlay endpoint:
cargo run --bin sos_relay -- --ws-host 10.0.0.42 --ws-port 49122Show all options:
cargo run --bin sos_relay -- --helpcargo run --bin sos_broadcastThis mode connects to Rocket League Stats API on localhost and hosts a websocket server for overlays/consumers:
- Input:
127.0.0.1:49123(default RL stats TCP source) - Output server bind:
0.0.0.0:49122(default websocket server)
Connect local consumers to:
ws://localhost:49122
Show all options:
cargo run --bin sos_broadcast -- --helpBehavior note:
sos_relaypushes to a remote websocket endpoint.sos_broadcasthosts the websocket endpoint and broadcasts to connected clients.
- If you do not pass an INI path, the client uses localhost defaults (
127.0.0.1:49123) and does not edit an INI file. - If you pass
--ini <path>, the INI file is created when missing and updated according to client options.
Expected INI template:
[TAGame.MatchStatsExporter_TA]
; Port the client will listen for connections on
Port=49123
; How many times per second the game sends the update state (capped at 120, 0 disables this feature)
PacketSendRate=60The Python module is built from this crate with the python feature.
Rust-side check:
cargo check --features pythonPackage metadata for Python builds is defined in pyproject.toml.
Filtering helpers are exposed for Python users as well, including:
RocketLeagueStatsClient.next_filtered_event_json(...)rlstatsapi.list_event_kinds()rlstatsapi.event_matches(...)rlstatsapi.filter_event_json(...)rlstatsapi.match_signal_json(...)rlstatsapi.winner_team(...)
A working Python consumer package is included at:
examples/python_library
Run it with uv:
cd examples/python_library
uv sync
uv run stream_events.pyAdditional examples:
uv run filtered_stream_events.py
uv run goal_scored_events.py
uv run player_watch.py
uv run player_board.py
uv run verify_filter_bindings.pyuse rlstatsapi::{ClientOptions, RocketLeagueStatsClient};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let options = ClientOptions::default();
let mut client = RocketLeagueStatsClient::connect(options).await?;
while let Some(event) = client.next_event().await? {
println!("{event:?}");
}
Ok(())
}This repository now has two release workflows:
Release(.github/workflows/release.yml) builds and publishes Rust binaries for:x86_64-unknown-linux-gnux86_64-pc-windows-msvcx86_64-apple-darwinaarch64-apple-darwin
Python Wheels(.github/workflows/python-wheels.yml) builds wheels for the same desktop platforms and uploads them to the same GitHub Release.
- Bump versions as needed.
- Create and push a version tag:
git tag v0.1.2
git push origin v0.1.2- Wait for
Releaseto publish binary artifacts. - Wait for
Python Wheelsto upload wheel artifacts to that release.
If the repository secret PYPI_API_TOKEN is set, the wheel workflow also publishes non-prerelease wheel builds to PyPI when a GitHub Release is published.
- Linux wheels use manylinux (Docker-backed) for compatibility.
- Windows and macOS binaries/wheels are built on native runners to avoid brittle cross-toolchain issues.
This gives repeatable Linux artifacts while still producing correct native outputs for Windows and macOS.