# MQTT mode

> The same contract over MQTT instead of HTTP.

MQTT mode carries the same [state](https://docs.remi.robot.com/fleets/state), [commands](https://docs.remi.robot.com/fleets/commands) and events as HTTP, over a broker Robot.com runs. Select it with `transport: "mqtt"` in [`PATCH /fleet`](https://docs.remi.robot.com/fleets/reference#updateFleetConfig).

## Topics

| Topic | You | Payload | Notes |
| --- | --- | --- | --- |
| `fleet/{namespace}/bot/{bot_id}/state` | Publish | [BotState](https://docs.remi.robot.com/fleets/partner-api#type-BotState) | QoS 1, retained. Publish whenever something meaningful changes. |
| `fleet/{namespace}/bot/{bot_id}/event` | Publish | [BotEvent](https://docs.remi.robot.com/fleets/partner-api#type-BotEvent) | QoS 1, not retained. Optional. |
| `fleet/{namespace}/bot/{bot_id}/command` | Subscribe | [BotCommand](https://docs.remi.robot.com/fleets/partner-api#type-BotCommand) | REMI publishes at QoS 2, not retained. |

## Connections

- Open one connection per bot, with client id `fleet-{namespace}-{bot_id}-hb`. REMI takes `connected` from that connection, not from the payload.
- Username `fleet_{namespace}`, with the password and broker address you get at onboarding.

## Commands without a reply

There is no answer to a command message. Confirm it by putting its `id` in `current_command` of the bot's next state, or reject it there with `state: rejected`. An unconfirmed command is published again with the same `id` every 10 seconds, 3 times in total.
