Skip to content

Reference server for protocol v0 - #1

Merged
RalfLeonFasler merged 13 commits into
mainfrom
design-v0
Nov 6, 2026
Merged

RalfLeonFasler merged 13 commits into
mainfrom
design-v0

Conversation

@RalfLeonFasler

Copy link
Copy Markdown
Contributor

Summary

The reference server for OpenBikeNet protocol v0 (OpenBikeNet/protocol#1), in Rust with axum + tokio.

  • protocol: parses and checks app messages and maps each problem to the spec's error codes; builds server messages
  • routes: loads routes/*.json from the protocol/ submodule and checks the profile rules
  • presence: in-memory routes → rooms → riders. Join, batched updates, leave, the 200 ms per-rider rate limit and the 10 s timeout. It is pure: time is passed in, and every call returns the messages addressed to each connection.
  • metrics: per-app daily rider-minutes, versions and first/last seen in SQLite, served at GET /v0/stats
  • ws: the /v0 WebSocket endpoint. It handles the hello timeout, size and error limits, pings, the 10-connections-per-IP limit, and a 1024-message outgoing queue per connection (a slow reader is closed instead of blocking the others).
  • obn-fake-app: a CLI that puts bot riders on a route, for manual tests and as an example for app developers
  • docs/design.md: fan-out now goes through addressed deliveries instead of broadcast channels

Depends on OpenBikeNet/protocol#1: the submodule points at that branch's head (a557731), so after that PR is merged the submodule should be bumped to the merge commit.

Test plan

  • cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace: 50 tests, 3 consecutive runs green. These include every protocol example and every invalid example's error code, plus WebSocket integration tests for the full lifecycle, reconnects, the per-IP limit and the stats endpoint.
  • Manual: server plus two fake apps. Each saw the other's bots join and leave, and /v0/stats showed both apps with the right rider counts.

🤖 Generated with Claude Code

RalfLeonFasler and others added 11 commits November 6, 2026 13:32
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dropping only the sender left the reader loop running, so an app that
stopped reading but kept sending stayed in presence until the pong timeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RalfLeonFasler and others added 2 commits November 6, 2026 17:10
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RalfLeonFasler
RalfLeonFasler merged commit d10c114 into main Nov 6, 2026
2 checks passed
@RalfLeonFasler
RalfLeonFasler deleted the design-v0 branch November 6, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant