Subscribe to Live Telemetry with MQTT
MQTT is handy when several little programs want the same data. One can draw a dashboard, another can log the flight, and a third can blink something ill-advised.
Connect
Section titled “Connect”The guest shell receives $GATOS_MQTT when MQTT is enabled. On the host, the preferred broker is
127.0.0.1:1883; the status window shows the actual port.
apk add mosquitto-clientsmosquitto_sub -h sim -p 1883 -t 'gatos/#' -vmosquitto_sub -h 127.0.0.1 -p 1883 -t 'gatos/events' -v- Subscribe to
gatos/snapshotand note that a value arrives immediately. It is retained. - Subscribe to
gatos/eventsand stage or ignite a vessel. Events are live, not retained. - Subscribe to
gatos/sim/vessels/active/altitude/radarfor the field-level mirror.
Send a command
Section titled “Send a command”mosquitto_pub -h sim -p 1883 -t gatos/command -m \ '{"vessel_id":"Hunter","action":"vessel.throttle","value":0.5}'Use the exact vessel id and action key. Commands report results on the command-result topic described in the MQTT reference.
MQTT publishing is subscription-gated, changed-only, and rate-capped. Unsubscribed topics cost very little, which is a nice property for a feature named after shouting messages into space.
MQTT referenceTopic families, retention, field mirrors, commands, cadence, and binding behavior.