Jump to content
APAPE

TIcsMQTTClient.Publish does nothing for me.

Recommended Posts

Hi

 

I do not know, what's going wrong and why.

Using the TIcsMqttClient component, it is not possible for me to send any payload.

When I debug the code, i found out, that in procedure TCustomWSocket.TryToSend in line 7365 -> Count := RealSend(Data, Len);

the return value (count) is always: -1

 

I am using V9 beta 3, but tried it also with 9.2

 

Thx for helping

Share this post


Link to post

Have you tried building and testing the OverbyteIcsMQTTst sample?  It contains both client and server components, to send to each other.  There is a publish button, does it work?

 

Sorry, I know little about MQTT, not used it for any of my own projects, this is a contributed component that I improved for SSL and the latest ICS,.

 

The sample seems to work OK, but please let us know if it does not work as expected, it has not been tested against non-ICS clients or servers.

 

Angus

 

Share this post


Link to post

No, I did not build / used the OverbyteIcsMQTTst sample. But now I did 🙂.

With it I found out, that using the "https://test.mosquitto.org/" it can be connected, but the client (sample application) does not get "online".

Regardless, which port I use (?).

 

Then I tried "public.mqtthq.com". Here it connected and went online. But sending or receiving messages did not work for me.

Then I tried "broker.emqx.io". Connection worked fine, but sending or receiving messages also did not work.

Same with "mqtt.eclipseprojects.io".

 

That was curios! After playing a little bit with the topic names for sending and receiving message, I found out, that these public MQTT Server accept all topics, but only send the messages when the topic is not longer than 14 characters.

I did not find any hint for that behavior on there web sites. After rethinking about it, it's clear why.

The reason why using Mosquitto does not let the sample application go online with the TIcsMQTTClient component / ICS Library, I have no idea. But yesterday I used only this MQTT broker and wondered why I could not send or receive any message. Thank's to the sample application, now it's clear why: not online.

 

Hope, this helps others. Topic can be closed.

 

Share this post


Link to post

As I said, I've never really looked at the MQTT protocol.  Is it now working?

 

Are there changes we should be making to the MQTT component or sample to make it work with other servers and clients?

 

Angus

 

Share this post


Link to post

Thanks, I'll test against Mosquitto MQTT server for the next release, and adapt the component if possible, but we don't always try to work with buggy or old servers.

 

Angus

 

Share this post


Link to post

As far as I know Mosquitto is the reference implementation for MQTT.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×