bitbroker

Crates.iobitbroker
lib.rsbitbroker
version0.0.1-alpha
created_at2025-08-24 20:23:38.564872+00
updated_at2025-08-24 21:00:54.718728+00
descriptionA language agnostic message broker designed for real-time communication.
homepage
repositoryhttps://gitlab.com/tuck-ab/bitbroker
max_upload_size
id1808755
size19,702
(tuck-ab)

documentation

README

BitBroker

BitBroker is a lightweight, language agnostic message broker designed for real-time communication between games and bots. Using TCP sockets for fast, persistent connections and designed for Protocol Buffers (Protobuf) allowing for compact, schema-based messaging, BitBroker acts as a reliable middle layer — brokering messages between clients and servers regardless of their underlying tech stack.

Running the broker

The broker is implemented as part of the rust package. A basic broker runner is included in /broker and can be run using cargo.

cargo run -p broker

The broker can also be run from a distroless docker image which can either be built from the Dockerfile or pulled from the project's container registry.

docker pull registry.gitlab.com/tuck-ab/bitbroker:{version}

The BROKER_NUM_PLAYERS environment variable must be set for the broker to know how many player connections to expect.

The image also contains a healthcheck api for use with a compose file.

services:
  bitbroker:
    image: registry.gitlab.com/tuck-ab/bitbroker:{version}
    healthcheck:
      test: curl localhost:8080
    environment:
      BROKER_NUM_PLAYERS: 2

Usage

There are currently two language implementations that abstract the messaging protocols.

Rust

The rust crate provides a trait to implement for a bot BaseBot and a function run_bot that takes a BaseBot, host, and port of the broker and handles running the bot. Similarly, there is a BaseGame trait and run_game function for implementing and running a game.

Python

The python package provides an abstract base class BaseBot with a run method that takes the host and port of the broker. Similarly there is a BaseGame abstract base class with its own run method that takes a host and port.

The python package can be installed from the project container registry using pip.

pip install bitbroker --index-url https://gitlab.com/api/v4/projects/70133808/packages/pypi/simple

Roadmap

  • Creating an installable rust crate
  • Creating an installable python package
Commit count: 60

cargo fmt