RotorLab logo RotorLabDocs

Cloud relay and the agent

The cloud relay lets you watch a test aircraft from anywhere. A small agent runs next to the flight controller and dials out to RotorLab over WSS; anyone in your organization with access to Live Telemetry opens the page and watches the stream. The aircraft needs no public address, no open inbound port, and no certificate. The relay is your organization's: only members of the organization that owns the device key can see its stream, and the relay never parses the stream, which keeps it firmware-agnostic.

The relay is view-only. The agent sends telemetry and the relay sends the aircraft nothing, so nothing you do on the page reaches the flight controller. A viewer that tries to send data is disconnected.

Run the agent anywhere a MAVLink stream is reachable: the aircraft's companion computer, a laptop, the ground-station box, or a cloud SITL host. Any MAVLink source works, since mavlink-router, mavproxy, QGroundControl forwarding, and SITL all expose a UDP or TCP endpoint the agent can read, and the agent can also talk to a flight controller's serial port directly.

Device keys#

Each aircraft or bridge signs in with its own device key, made for your organization and not for a person. An organization admin, or a member whose role holds Integrations: manage, makes and revokes them. Any other member with access to Live Telemetry sees the device list and picks a device to watch, but Create device key and Revoke are not shown; the panel says that creating and revoking device keys needs the Integrations permission, so ask an organization admin to create a key for your aircraft.

  1. Open Live Telemetry (under Engineering, then Analyze) and open Cloud relay setup.
  2. Type a Device name, such as "Hexa 2" or "Bridge inspector", and press Create device key.
  3. Copy the key now. It starts with rlrd_ and is shown once; RotorLab keeps only a fingerprint of it.

Your organization can hold up to 50 active device keys. The Your organization's relay devices list shows each device's name, whether its agent is online, and Revoke. A revoked key is disconnected within seconds and never works again. Making, using and revoking a key are written to your organization's activity log with the device name.

Give each aircraft or bridge its own key. If a second agent connects with a key that another agent is already using, the newcomer takes the device from the agent holding it, once in each minute (three times in a minute when either agent sends no instance mark of its own, because the relay then cannot tell a reconnect from a second agent). Past that the relay refuses the newcomer and the agent holding the device keeps it; the refused agent waits a minute, then longer, up to five minutes, before it tries again. Two agents on one key knock each other off in the meantime, so keep a separate key for each.

A device key opens the relay and nothing else: it cannot read records or call the HTTP API. Your personal API keys do not work on the relay: an agent always signs in with a device key.

Get and run the agent#

The agent is a single Python 3 script with no dependencies beyond the standard library. Press Download agent script in the Cloud relay setup panel. The panel also prints ready-to-run command lines filled in with the relay address.

Put the device key in the environment of the process, not on the command line, and point the agent at your MAVLink source. Pick the transport your setup exposes:

export ROTORLAB_DEVICE_KEY=rlrd_your_device_key

# UDP (the usual mavlink-router / mavproxy output)
python3 rotorlab_relay_agent.py --url wss://app.rotorlab.app/relay/agent --udp 127.0.0.1:14550

# TCP (SITL on 5760, or a mavlink-router / mavproxy TCP server)
python3 rotorlab_relay_agent.py --url wss://app.rotorlab.app/relay/agent --tcp 127.0.0.1:5760

# serial flight controller
python3 rotorlab_relay_agent.py --url wss://app.rotorlab.app/relay/agent --serial /dev/ttyAMA0 --baud 921600

The agent connects only over wss://. It refuses a plain ws:// address unless the address is this computer (localhost, 127.0.0.1 or ::1), for a relay you run yourself, or you add --insecure, which sends your key and telemetry unencrypted, so use it only on a network you trust.

With --serial, --baud defaults to 115200. The agent reconnects on its own with capped backoff (doubling up to a 30-second ceiling), so it is suitable to run as a systemd service that comes up with the aircraft.

How a client signs in#

A client that is not the downloaded agent presents the device key one of two ways:

  1. An Authorization: Bearer <key> header. The downloaded agent uses this.
  2. The WebSocket subprotocol Sec-WebSocket-Protocol: rotorlab.v1, key.<key>, for clients that cannot set custom headers.

A key in the address is refused. Keep the key out of URLs, shell history and logs.

The browser side#

On the Live Telemetry page, set Connection to RotorLab Cloud relay and pick the device from the list. Before you connect, the Drone agent pill shows whether that device's agent is online. Press Connect. The picture shows the connection row set to the cloud relay with the device's agent online.

The connection row set to RotorLab Cloud relay with the Drone agent pill online

If you connect before the agent is up, the page reports that it is waiting for the drone; telemetry starts flowing the moment the aircraft dials in.

Betaflight and INAV (MSP) cannot be watched over the relay. MSP answers only when asked, and the relay carries nothing toward the aircraft, so choosing Betaflight / INAV (MSP) with the relay shows "Betaflight and INAV (MSP) answer only when asked, and the cloud relay is view-only: it carries nothing toward the aircraft. Use ArduPilot (MAVLink) or RotorLab telemetry over the relay, or USB or Network for MSP."

Model Calibration reaches the relay the same way: set its Connection to RotorLab Cloud relay, pick the Relay device, and press Connect. Calibration reads ArduPilot (MAVLink) over the relay. Pressing Connect with Betaflight / INAV (MSP) and the relay warns, as Live Telemetry does: "Betaflight and INAV (MSP) answer only when asked, and the cloud relay is view-only: it carries nothing toward the aircraft. Use ArduPilot (MAVLink) over the relay, or USB or Network for MSP."

If the relay connection closes because RotorLab is updated or restarted, or your network drops, the view reconnects by itself: the page says it is reconnecting and tries again after 1, 2 and 4 seconds and so on, at most 30 seconds apart. It stops, and says why, when your access ends.

Several people in your organization can watch the same device at once, and nobody takes the link from anybody else, within these limits:

  • 8 viewers on one device. The page says eight people are already watching the device, the most one device allows; try again when one of them closes the page.
  • 4 views per person. The page says you already have four relay views open; close one of them and press Connect again.
  • 40 views per organization. The page says your organization already has forty relay views open; try again when one of them closes.

Adapters for anything else: RotorLab telemetry (RLT)#

The relay carries opaque bytes, so it is not limited to MAVLink. For a source with no byte protocol (a vendor cloud API, a custom tracker, a simulator), an adapter connects to the same /relay/agent endpoint with a device key and sends RotorLab telemetry: one small JSON object per binary frame, carrying position, attitude, battery, mode, and arm state, with units fixed in the field names. On the Live Telemetry page, pick Any aircraft (RotorLab telemetry) as the firmware and connect through the relay as usual; recording and replay work unchanged.

Fields your source does not report are simply left out, and the cockpit shows the gap rather than a made-up value. RLT links are receive-only: the page never sends anything to an RLT adapter. The full format and a complete reference adapter that flies a scripted demo flight are on the developers page.

Capacity behavior in plain words#

  • Slow viewers are shed, not obeyed. If a viewer's network stalls, the oldest frames are dropped rather than letting one slow browser hold up telemetry. MAVLink decoders resynchronize on the next frame boundary, so a dropped frame costs a moment of data, not the session.
  • Dead connections are reclaimed. A connection that stays silent past an idle limit is closed, so a lost peer is cleaned up in under a minute.
  • A short buffer, not a recording. A viewer who joins sees roughly the last half minute of the stream first. Use Record on the Live Telemetry page to keep a flight. A recording saved to your account over the relay names its aircraft only when the relay device's aircraft matches the sortie you flew as pilot while recording; a relay device alone does not name the aircraft (see Record and replay).