Skip to content

URL Encoding (MQTT)

Carter Tinney edited this page Oct 16, 2020 · 4 revisions

The rules for URL encoding data that is sent on the wire over MQTT are somewhat inconsistent due to the requirements of the IoTHub service. The following are the policies that must be followed for compatibility:

  • MQTT Username is expected to be structured as {hostname}/{clientid}/?{properties}
  • MQTT Topic for telemetry is structured as devices/{clientid}/messages/events/?{properties}
  • {clientid} may stand for {deviceid} or {deviceid}/modules/{moduleid}.
  • {deviceid} and {moduleid} are not decoded whatsoever. Neither in topic, nor in username.
  • {properties} is a sequence of {key}={value}&… . Both {key} and {value} are assumed to be %-encoded and we’d decode any character properly encoded with percent encoding.
Clone this wiki locally