Alberto Fornés 22 Posted 8 hours ago Hi, I have a Mosquitto server that publishes messages and I can subscribe to it using programs like MQTT Explorer. By testing with TIcsMQTTClient, I can connect to the host and port (it also uses a username and password) and it validates. I subscribe to a topic, but I don't receive any messages like I see in MQTT Explorer. Is there anything I should check that could be causing me to not receive the messages? Share this post Link to post
Angus Robertson 645 Posted 7 hours ago First place to look would be the Mosquitto log file, maybe subscribe failed for some reason. I did test the latest version against local and remote Mosquitto servers, but my knowledge of the MQTT protocol is almost nil so I don't know what to expect when I click the various test buttons. Angus Share this post Link to post
Mark- 32 Posted 6 hours ago 2 hours ago, Alberto Fornés said: I subscribe to a topic,... Did you receive a SUBACK response when you subscribed? Share this post Link to post
Angus Robertson 645 Posted 5 hours ago My Mosquitto log shows exactly that. 2025-03-21T12:51:02: Received SUBSCRIBE from CID64860 2025-03-21T12:51:02: update/memo (QoS 2) 2025-03-21T12:51:02: Sending SUBACK to CID64860 Angus Share this post Link to post
Alberto Fornés 22 Posted 4 hours ago This is the Mosquito log when connect to server: Quote 1747327152: New connection from 192.168.1.130:52181 on port 1883. 1747327152: New client connected from 192.168.1.130:52181 as CID52177 (p1, c0, k10, u'keeptrack_cajas'). 1747327152: Will message specified (19 bytes) (r0, q2). 1747327152: will/CID52177 1747327152: Sending CONNACK to CID52177 (0, 0) 1747327152: Received SUBSCRIBE from CID52177 1747327152: lectura/cajas/+ (QoS 1) 1747327152: CID52177 1 lectura/cajas/+ 1747327152: Sending SUBACK to CID52177 Share this post Link to post
Alberto Fornés 22 Posted 3 hours ago 2 hours ago, Mark- said: Did you receive a SUBACK response when you subscribed? Yes, it appears as the last message when I log in and subscribe Share this post Link to post
Mark- 32 Posted 3 hours ago 20 minutes ago, Alberto Fornés said: Yes, it appears as the last message when I log in and subscribe OK. > but I don't receive any messages like I see in MQTT Explorer. Is it the lack of a confirmation the subscribe was successful? or Is the value in the server changing and you are not being notified? Share this post Link to post
Alberto Fornés 22 Posted 2 hours ago 16 minutes ago, Mark- said: OK. > but I don't receive any messages like I see in MQTT Explorer. Is it the lack of a confirmation the subscribe was successful? or Is the value in the server changing and you are not being notified? I don't receive any message in the event: MQTTClientMsg(Sender: TObject; aTopic: UTF8String; aMessage: AnsiString; aQos : TMQTTQOSType; aRetained : boolean) Share this post Link to post
Angus Robertson 645 Posted 2 hours ago The onClientMsg event is only triggered for published messages, Sorry, don't know off hand which event is triggered to acknowledge subscribe, you'll need to check the source code. Angus Share this post Link to post
Alberto Fornés 22 Posted 1 hour ago Problem solved. I set the subscription to reading/boxes/+, and the correct option was reading/boxes/#. Thanks to those who responded and tried to help.👍 Share this post Link to post