eclipse-mosquitto / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
9.12k stars 2.41k forks source link

How to get CONNECT_Packets's connect_properties in plugin #3149

Closed luckychengww closed 3 weeks ago

luckychengww commented 3 weeks ago

Recently, I have a task to develop a mosquitto broker plugin which needs to retrieve CONNECT_Packets's connect_properties and publish them to a specified topic.

When I collect information about mosquitto and plugin develop from the github and mosquitto.org , I found that there is no supported api and I may have to modify the source code. https://github.com/eclipse-mosquitto/mosquitto/issues/2269

Can someone provide me with some guidance or rough ideas for making modifications?

connect_properties is an importent new feature in MQTTv5, but why some callback events in plugin unable to retrieve connect_properties ?

luckychengww commented 3 weeks ago

According to "handlepublish" function in src/handle_public.c and "plugin__handle_message" function in src/plugin.c , i modify the "handleconnect" function in src/handle_connect.c and "mosquitto_unpwd_check" function in src/security.c. It worked. thanks