changeset 5111:6ba2188e2686

mod_pubsub_mqtt: Add XEP-0060 <item> wrapper to payloads
author Matthew Wild <mwild1@gmail.com>
date Fri, 16 Dec 2022 12:11:16 +0000
parents 43b67142b37c
children 9499b88f3453
files mod_pubsub_mqtt/mod_pubsub_mqtt.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_pubsub_mqtt/mod_pubsub_mqtt.lua	Fri Dec 09 21:03:51 2022 +0100
+++ b/mod_pubsub_mqtt/mod_pubsub_mqtt.lua	Fri Dec 16 12:11:16 2022 +0000
@@ -41,8 +41,8 @@
 	end
 	local id = "mqtt";
 	local ok, err = pubsub:publish(node, true, id,
-		st.stanza("data", { xmlns = "https://prosody.im/protocol/data" })
-			:text(packet.data)
+		st.stanza("item", { xmlns = "http://jabber.org/protocol/pubsub", id = id })
+		  :text_tag("data", packet.data, { xmlns = "https://prosody.im/protocol/data" })
 	);
 	if not ok then
 		module:log("warn", "Error publishing MQTT data: %s", tostring(err));