Hello,
I'm new to vernemq and MQTT 5. I'm using vernemq as a broker for mobile units to talk to server processes and trying to minimize traffic for the mobile users. I essentially need the server processes to receive the authid or client id (if authenticated) for each message they receive. I've been experimenting and while my hook is being called, I can't get any changes to the publication alter what my server process receives.
BTW, also not a Lua pro.
function my_on_deliver(pub)
print("on_publish hook triggered for topic: " .. pub.topic)
log.info("======== on_publish " .. pub.topic .. " ========")
if not pub.properties then
pub.properties = {}
end
log.info("pub.properties.p_response_topic: " .. (pub.properties.p_response_topic or "(none)"))
pub.properties.p_response_topic = "asdf"
if not pub.properties.p_user_property then
pub.properties.p_user_property = {}
end
log.info("pub.properties.p_user_property['sender']: " .. (pub.properties.p_user_property["sender"] or "(none)"))
pub.properties.p_user_property["hello"] = "o"
return true
end
hooks = {
on_deliver_m5 = my_on_deliver,
}Does this hook not support any changes? Ideally, I would like to have mobile clients auth, and if they get a new session to add some data to it that the server-side clients can access or receive upon publish.
Thank you!
Daniel