Repository navigation
Description
Prerequisite: #68 (laps on loop routes, closes #67). This builds on it, so I would start once #68 is merged.
Goal
Let VeloPopuli riders meet riders of other indoor cycling apps. OpenBikeNet is an open protocol for this: apps report where their riders are on a shared route and see the other apps' riders. Each app keeps its own physics, and nothing else is shared. A public server already runs at wss://openbikenet.cloud/v0 (stats). Anyone can run their own (OpenBikeNet/server), which fits the README's self-hosted servers goal.
I maintain OpenBikeNet and OpenRadlr, the first app that speaks it, so this would be the second app. I'd build it and keep the PR small.
What VeloPopuli already has
| Piece | Where | Use |
|---|---|---|
| Remote riders in the engine | RideEngine::set_remote / remove_remote (crates/core/src/ride.rs) |
OBN riders become remote rivals, like group-ride friends |
| A WebSocket link modelled per ride | src-tauri/src/group.rs |
Template for the OBN link: connect, send position, reconnect |
| A status line on the ride screen | group_status in session.rs |
"OpenBikeNet · 3 riders from other apps" |
| Laps on loop routes | #67 / #68 | OBN positions are on a loop with a lap count (spec 4.3) |
| Offline built-in route | demo_route() in crates/core/src/gpx.rs |
Pattern for a built-in velodrome |
Missing: a velodrome route, the OBN messages, the link, and settings.
Proposal (one PR, after #68)
Route. A built-in velodrome-250: flat, 250 m, closed, next to demo_route() and offline like it. The shared route file is routes/velodrome-250.json. It sits in the route list like the Demo Loop. Riders ride it with laps (#67).
Protocol (pure, in crates/core, unit-tested). Serde types for the v0 spec messages: hello, subscribe, join, update, leave and ping, and from the server welcome, snapshot, joined, updated, left, error and pong. Plus the rules other apps learned the hard way:
- unknown server message types are ignored;
- display names are cleaned before showing them;
- a
fatalerror means back off; - the engine's distance is mapped to the route's
[0, 250), andlapto laps finished.
Link (src-tauri, modelled on group.rs).
- It connects, says
helloasvelopopuli, subscribes tovelodrome-250in thepublicroom, and joins the rider. - It sends
updateat 1 Hz andleavewhen the ride ends. - It reconnects with backoff and pings after silence (spec 3.5).
- Other apps' riders show as remote rivals, labelled with their app ("Anna · OpenRadlr").
Smooth riders. Remote riders only move when an update arrives, which looks jerky at 1 Hz. The engine would move them on at their last speed between updates, capped at 2 s. It's a small change to the core, with its own test, and it also smooths group-ride friends.
Settings.
- An Other apps (OpenBikeNet) section with an on/off switch, off by default, preset to the public server, and a server address you can change.
- A switch for sharing power and cadence, as the spec's privacy section asks (spec 10).
- Only the display name you already set is sent.
Kept small for v1.
- OBN is only on the velodrome.
- On the velodrome, a ride uses OBN or a group-ride room, not both: Ride with friends is off there while OBN is on.
- The existing relay and group rides are unchanged.
Open questions
- Off by default with the public server preset, or on by default? I'd keep it off: it sends your name and position to a server you didn't pick.
- Is a built-in velodrome OK in the route list, or would you rather it only appears when OBN is on? I lean towards always showing it, since it's a nice short loop on its own.
First version (acceptance)
-
velodrome-250is built in, offline, closed, 250 m ± 0.5 m (core test) - OBN messages round-trip against the spec's examples, with the join-then-update order and name cleaning (core tests)
- Remote riders move on between updates, capped at 2 s (core test)
- VeloPopuli and OpenRadlr see each other's riders on the velodrome through a local reference server and through
openbikenet.cloud; screenshots from both - Off by default; with it off, nothing connects
- README, wiki ("Riding with other apps") and HANDOFF updated
The protocol is v0 and may still change. Route files never change once published (spec 4.2), so the velodrome is stable.
Sources
- Spec: https://github.com/OpenBikeNet/protocol/blob/main/spec/v0.md
- Reference server: https://github.com/OpenBikeNet/server
- Public server stats: https://openbikenet.cloud/v0/stats
Activity