# HiveMQ migration verifier

A local MQTT.js check for a target broker you control. Node >=22.12 and `mqtt@5.15.2` are required. Install MQTT.js in the directory containing `verify.mjs`, then use `node verify.mjs --help`.

Full setup: https://runmqtt.com/docs/migrate-from-hivemq-cloud
中文说明：https://runmqtt.com/zh-Hans/docs/migrate-from-hivemq-cloud

Use a dedicated test identity with publish/subscribe on a concrete test prefix. Supply `MQTT_URL`, `MQTT_USERNAME`, `MQTT_PASSWORD`, and optionally `MQTT_TEST_PREFIX`, `MQTT_VERSION=4|5`, `MQTT_CHECK_RETAINED=0|1` through your local environment or a private, uncommitted env file. Only verified `mqtts://` and `wss://` transports are accepted. Credentials must not appear in the URL.

The script opens clean-session clients, sends unique synthetic messages, verifies actual receipt, and optionally checks retained replay, the retain flag, and retained cleanup using a fresh subscriber. It never prints hostnames, usernames, passwords, topics or payloads. Network connections and messages may incur usage charges. It does not connect to the source broker, export customer data, alter existing device settings or transfer sessions.

Exit 0 means all selected checks passed. Exit 1 means a transport, round-trip, cleanup or requested retained check failed. Exit 2 means invalid settings. `cleanup=false` or a timeout needs manual inspection of the authorized test namespace and cleanup of retained test state. Revoke the test device and delete the credential file afterward.

A retained payload with `retain=false` is explicitly a failed retained-conformance check. No successful round trip proves capacity, availability, every MQTT feature, Home Assistant compatibility or a downtime-free migration.

Run the result-boundary tests with `node --test verify.check.mjs`.
