diff --git a/client/client_shared.c b/client/client_shared.c
index 01affcaf..029b07b8 100644
--- a/client/client_shared.c
+++ b/client/client_shared.c
@@ -73,6 +73,8 @@ static int check_format(const char *str)
// payload length
}else if(str[i+1] == 'm'){
// mid
+ }else if(str[i+1] == 'P'){
+ // MQTT v5 property user-property
}else if(str[i+1] == 'p'){
// payload
}else if(str[i+1] == 'q'){
diff --git a/client/sub_client_output.c b/client/sub_client_output.c
index d4bcb681..32d7af67 100644
--- a/client/sub_client_output.c
+++ b/client/sub_client_output.c
@@ -338,7 +338,8 @@ static void formatted_print(const struct mosq_config *lcfg, const struct mosquit
uint8_t i8value;
uint16_t i16value;
uint32_t i32value;
- char *binvalue, *strvalue;
+ char *binvalue, *strname, *strvalue;
+ const mosquitto_property *prop;
len = strlen(lcfg->format);
@@ -433,6 +434,26 @@ static void formatted_print(const struct mosq_config *lcfg, const struct mosquit
printf("%d", message->mid);
break;
+ case 'P':
+ strname = NULL;
+ strvalue = NULL;
+ prop = mosquitto_property_read_string_pair(properties, MQTT_PROP_USER_PROPERTY, &strname, &strvalue, false);
+ while(prop){
+ printf("%s:%s", strname, strvalue);
+ free(strname);
+ free(strvalue);
+ strname = NULL;
+ strvalue = NULL;
+
+ prop = mosquitto_property_read_string_pair(prop, MQTT_PROP_USER_PROPERTY, &strname, &strvalue, true);
+ if(prop){
+ fputc(' ', stdout);
+ }
+ }
+ free(strname);
+ free(strvalue);
+ break;
+
case 'p':
write_payload(message->payload, message->payloadlen, 0);
break;
diff --git a/man/mosquitto_rr.1.xml b/man/mosquitto_rr.1.xml
index f5e11ddf..d95c3bf8 100644
--- a/man/mosquitto_rr.1.xml
+++ b/man/mosquitto_rr.1.xml
@@ -675,6 +675,9 @@
the MQTT v5 payload-format-indicator property, if present. the length of the payload in bytes. the message id (only relevant for messages with QoS>0).
+ the MQTT v5 user-property property, if present. This will be printed in the
+ form key:value. It is possible for any number of user properties to be attached to a message, and to
+ have duplicate keys. the payload raw bytes (may produce non-printable characters depending on the payload). the message QoS. the MQTT v5 response-topic property, if present.
diff --git a/man/mosquitto_sub.1.xml b/man/mosquitto_sub.1.xml
index e6d8d2ea..9dd1cbac 100644
--- a/man/mosquitto_sub.1.xml
+++ b/man/mosquitto_sub.1.xml
@@ -792,6 +792,9 @@ mosquitto_sub -t 'bbc/#' -T bbc/bbc1 --remove-retained
the MQTT v5 payload-format-indicator property, if present. the length of the payload in bytes. the message id (only relevant for messages with QoS>0).
+ the MQTT v5 user-property property, if present. This will be printed in the
+ form key:value. It is possible for any number of user properties to be attached to a message, and to
+ have duplicate keys. the payload raw bytes (may produce non-printable characters depending on the payload). the message QoS. the MQTT v5 response-topic property, if present.