Robotics client per (tenant, robot), then open scoped publications and
subscriptions. The client holds a single MoQT session, connects lazily on the
first call, and auto-reconnects — replaying every publication and subscription
on reconnect — so your code does nothing on a link flap.
Import
Construct a client
RoboticsOptions
Relay host or full URL —
"relay.clutchcall.dev" or
"https://relay.clutchcall.dev". Every namespace derives from it.The robot this client speaks for. Used to build
robot/<id> (telemetry) and
robot/<id>/ctl (commands).Bearer token for the relay session, scoped to
(tenant, robotId).Base64 SHA-256 of the relay’s cert, for pinned WebTransport in the browser.
Inject a custom WebTransport factory (Node polyfill / tests).
Called when the underlying relay session closes with an error.
Methods
publishTelemetry(spec)
Open a robot → cloud track under robot/<id>. Returns a RoboticsPublication.
Track name under the telemetry namespace, e.g.
"odom", "battery_state".Full ROS 2 message type, e.g.
"nav_msgs/msg/Odometry". Prefixed on the wire.QoS profile (below). Omit for the best-effort default.
publishCommand(spec)
Open a cloud → robot track under robot/<id>/ctl. Same spec shape as
publishTelemetry; returns a RoboticsPublication.
subscribeTelemetry(spec, onMessage)
Receive robot → cloud frames from robot/<id>. The callback gets the raw CDR
payload and the wire type name — use the type name to guard / route.
Track name to subscribe under the telemetry namespace.
Invoked per delivered message.
cdr is the opaque payload; typeName is the
prefix decoded off the wire.subscribeCommand(spec, onMessage)
Receive cloud → robot frames from robot/<id>/ctl. Same shape as
subscribeTelemetry; this is the call the robot (or the on-robot bridge) makes
to pick up teleop commands.
close()
Tear down the underlying MoQT session and all publications / subscriptions.
Idempotent.
Handles
RoboticsPublication
Returned by publishTelemetry / publishCommand.
Push one typed message.
cdr is the raw CDR (or whatever matches your
typeName); the SDK prepends the type-name prefix and opens a fresh MoQT group
per message. priority (TypeScript) overrides the QoS default for this single
frame — 0 highest, 255 lowest. Returns immediately; the MoQT layer handles
ordering and reliability.Stop publishing this track.
RoboticsSubscription (TypeScript)
subscribeTelemetry / subscribeCommand resolve once the subscription is
attached. In the TypeScript SDK the resolved handle exposes close() to stop
receiving; in Python / Go the returned subscription object exposes the same.
QoS profile
| Field | Maps to |
|---|---|
reliability | subgroup stream (reliable) vs QUIC datagram (best_effort) |
durability | transient_local adds late-join retain |
depth | per-track recent-group window for late subscribers |
SensorDataQoS (best-effort, volatile,
keep-last). See Details → QoS → lanes for the
full capability mapping.
Events & lifecycle
- Connection state — the client surfaces relay session lifecycle
(
Connecting · Connected · Reconnecting · Closed · Failed). In TypeScript passonStatevia the underlying options; in other SDKs the connect callback reports state codes. Auto-reconnect with capped backoff re-attaches every track on its own. - Late join — a subscriber that joins after a publisher immediately receives
the relay’s retained group window (sized by
depth, latched bytransient_local). - Errors —
onError(TypeScript) fires on relay close with a reason string; individual publish/subscribe calls reject if the session can’t be established.

