Repository navigation
robot console
The relay pool (7444) and /names API (7445) that let robot-console use mbregistry in place of the old mbrelay server.
Robot-console was written against the legacy mbrelay relay server.
mbregistry serves the same contract, so robot-console needs no
changes. It finds relays over mDNS exactly as before; only the ports
differ, and those are advertised.
Legacy mbrelay.service
|
mbregistry |
|
|---|---|---|
| mDNS | _mbrelay._tcp |
_mbrelay._tcp (same) |
| Pool port (SRV) | 8760 | 7444 |
Names API (TXT registry=) |
8761 | 7445 |
Both listeners run inside mbregistry run. The pool only serves this
host's own relays, never a peer's.
On each new TCP connection:
- The pool picks a free local relay: role contains RELAY or BRIDGE,
connected, unlocked. It takes a
relaylock on it. - It resets and normalizes the relay to factory defaults and verifies it.
It then sends the board's announcement line (e.g.
DEVICE:RADIOBRIDGE:relay:<name>:<id>) followed by\r\n. - After that the connection is a raw, transparent byte pipe to the relay until the client disconnects.
- On disconnect it restores the relay's stored defaults and releases the lock. Reconnecting resets the relay. Pool connections have no BREAK, and clients rely on this behaviour instead.
If no relay is free, the client gets one comment line and the connection closes:
# ERROR: no relay available (3 devices, 3 in use)
Hosts without relays should run mbregistry run --no-relay-pool. That
also stops them from advertising _mbrelay._tcp.
Maps a robot name to its radio (channel, group). Always on, no
authentication.
| Request | Effect | Response |
|---|---|---|
GET /names/<name> |
Look up. If the name is unknown, derives and stores it. There is no read-only peek. | 200 {"channel": n, "group": n, "source": "derived"|"registry"} |
PUT /names/<name> with body {"channel": 12, "group": 4}
|
Explicit assignment |
200, same shape |
DELETE /names/<name> |
Drop the explicit entry; re-derives |
200, same shape (the fresh derived value) |
- Names must be five letters,
[zvgpt][uoiea][zvgpt][uoiea][zvgpt]. Anything else gets400. -
PUTaccepts channel0-83and group0-255, the range the relay's!CGaccepts. Out of range gets400, never a silent clamp. - Every write (including the first derive-on-GET) replicates to all peered hosts.
-
mbrelay names get/set/clear/listedit the same registry through the local daemon, not over HTTP.
From another machine on the LAN:
avahi-browse -rt _mbrelay._tcp # expect port 7444, TXT registry=7445
curl -s http://<host>:7445/names/<name> # {"channel": ..., "group": ..., "source": ...}
nc <host> 7444 # expect a DEVICE:RADIOBRIDGE:... banner, then type ? for statusEvery new nc connection should show a fresh banner and factory-default
tuning.
If robot-console was running during a host's cutover and its relay link seems stuck on the old port, restart robot-console. That forces a fresh mDNS discovery.