Recent

Author Topic: good mqtt client  (Read 7211 times)

promisetom

  • New Member
  • *
  • Posts: 11
good mqtt client
« on: April 29, 2021, 11:45:40 pm »
Hi All,
Has anyone used an MQTT client that works well and is reliable. I have tested a few but the system crashes with most components.
Tom

af0815

  • Hero Member
  • *****
  • Posts: 1291
Re: good mqtt client
« Reply #1 on: April 30, 2021, 07:40:18 pm »
I use it from https://github.com/bkeevil/mqtt.git It looks very stable. For me, i have created a package with lesser depenencies.
regards
Andreas

promisetom

  • New Member
  • *
  • Posts: 11
Re: good mqtt client
« Reply #2 on: May 02, 2021, 12:30:15 am »
I did test that out and it locked the whole system up.
All I need is a simple client to read data from an esp8266 and my weather station.
Only data once a minute or so.
Is your poackage available in the public domain. (i.e. me)

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: good mqtt client
« Reply #3 on: May 02, 2021, 12:50:12 am »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Tuxscreen

  • Newbie
  • Posts: 5
Re: good mqtt client
« Reply #4 on: February 02, 2022, 12:56:13 pm »
I am hijacking this thread, because it's the latest in my list about "mqtt" (but also older than 120days)

I am searching for help. I tried almost all referenced mqtt component suites, but all of them seem to break on current mosquitto servers (maybe the implemented mqtt protocol checks are now more strict?)
Most of the times a connection is made, but after some publishs, the connection is dropped because of an error 'insufficient data'
(I crosschecked with mqtt-spy and mqtt.fx - both work flawlessly)

Has anybody seen the same problems, and has found a solution?

BR
Marc

af0815

  • Hero Member
  • *****
  • Posts: 1291
Re: good mqtt client
« Reply #5 on: February 02, 2022, 03:33:26 pm »
I tried almost all referenced mqtt component suites, but all of them seem to break on current mosquitto servers

What mosquitto server and suit Excact, please with more details - Win / Linux / MacOs or whatever.
regards
Andreas

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: good mqtt client
« Reply #6 on: February 02, 2022, 05:08:10 pm »
Alternative: https://github.com/ZiCog/mqtt-free-pascal
Did you see that code?
Sorry Avra but this is someone that hits is own head with a hammer to avoid him making mistakes, gives himself a compliment, hit his head again and then distributes it accidentally so he can hit his head again.
The original was much cleaner and less prone to head-ache.

Anyway MQTT is a very simple protocol.

That code should be left alone.
« Last Edit: February 02, 2022, 05:11:48 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Tuxscreen

  • Newbie
  • Posts: 5
Re: good mqtt client
« Reply #7 on: February 02, 2022, 06:14:40 pm »
I tried almost all referenced mqtt component suites, but all of them seem to break on current mosquitto servers
What mosquitto server and suit Excact, please with more details - Win / Linux / MacOs or whatever.
Hi Andreas,
thanks.
Most trials I did with the components from Bond Keevil's mqtt (github) and a derived version with lesser dependencies.

Test setup:
Compiling and testing with Windows10/Lazarus2.2.0-64bit (latest)
Tested against:
1) official mosquitto broker (test.mosquitto.org:1883)
2) multiple versions of mosquitto on local machine (mosquitto v2.0.14 and mosquitto v1.6.13)

All setups are first tested with mqtt-spy and mqtt.fx and work flawlessly.

Mqtt-demo-app (provided with Bond Kevils mqtt) gives me the following errors
[...] Client has connected [...] (i subscribe to "#" or "$SYS/#") [...] after some published messages I get:
Bail: Insufficient data for packet - Client has been reset.

(the errors occur independently on my local machine broker or on the official testservers broker.


References:
(github) https://github.com/bkeevil/mqtt
(github same Lib, but less depends) https://github.com/afriess/mqtt/tree/LessDepends
https://github.com/ZiCog/mqtt-free-pascal see my results below


« Last Edit: February 02, 2022, 06:50:06 pm by Tuxscreen »

af0815

  • Hero Member
  • *****
  • Posts: 1291
Re: good mqtt client
« Reply #8 on: February 02, 2022, 06:44:41 pm »
Thx for the information. The last updates of Kevils repository are 3 yrs old. So i think some changes in mqtt and its security are missed. My last information is 2 yrs old, because i have used the component. Actual i have only some tests with debian based implementation and they works by the customer. So the information is indeed interesting. I will have an eye if the customer reports an issue.

Ok, the "less depends " its me.

BTW. I am in the german forum too - my native language
« Last Edit: February 02, 2022, 06:48:33 pm by af0815 »
regards
Andreas

Tuxscreen

  • Newbie
  • Posts: 5
Re: good mqtt client
« Reply #9 on: February 02, 2022, 06:48:03 pm »
Here come my test results for (https://github.com/ZiCog/mqtt-free-pascal)

(local machine broker mosquitto v2.0.13)
Example connects and bails out because of an malformed packet (see below or attachment screenshot)
Code: Pascal  [Select][+][-]
  1.  (broker log):
  2. 1643823735: New client connected from 127.0.0.1:53393 as dMQTTClientx982 (p1, c1, k40).
  3. 1643823735: Will message specified (20 bytes) (r0, q0).
  4. 1643823735:     lwt
  5. 1643823735: Sending CONNACK to dMQTTClientx982 (0, 0)
  6. 1643823735: Received SUBSCRIBE from dMQTTClientx982
  7. 1643823735:     /ivuvio/# (QoS 0)
  8. 1643823735: dMQTTClientx982 0 /ivuvio/#
  9. 1643823735: Sending SUBACK to dMQTTClientx982
  10. 1643823735: Client dMQTTClientx982 disconnected due to malformed packet.
  11. 1643823747: New connection from 127.0.0.1:53394 on port 1883.
  12.  
  13. (program log):
  14. embeddedApp MQTT Client.
  15. RX_START: Operation would block
  16. RX_START: 10035
  17. loop...
  18. RX_START:
  19. RX_START: 0
  20. SUBACK: 1, 0
  21. TMQTTClient.OnRTTerminate: Thread.Terminated.
  22. embeddedApp: Error: PingReq Failed.
  23. TMQTTClient.ForceDisconnect
  24. RX_START: Operation would block
  25. RX_START: 10035
  26. loop...
  27. RX_START:
  28. RX_START: 0
  29. SUBACK: 2, 0
  30. TMQTTClient.OnRTTerminate: Thread.Terminated.
  31.  

I suppose, this was once "working" code. But as the mqtt protocol got some hardening, and they hardened the rules for checking fields, now these mqtt-clients (or libs) do not work any longer.



af0815

  • Hero Member
  • *****
  • Posts: 1291
Re: good mqtt client
« Reply #10 on: February 02, 2022, 06:52:00 pm »
I see, some of the hardening is not in the repositories. So most (or all) of the repos need rework.
regards
Andreas

Tuxscreen

  • Newbie
  • Posts: 5
Re: good mqtt client
« Reply #11 on: February 02, 2022, 08:15:54 pm »
I see, some of the hardening is not in the repositories. So most (or all) of the repos need rework.

Do you remember which mosquitto broker version last worked for you?
Maybe you can tell me the month+year when you tested this stuff?

af0815

  • Hero Member
  • *****
  • Posts: 1291
Re: good mqtt client
« Reply #12 on: February 02, 2022, 09:11:30 pm »
Two years ago with a version on a raspbian system, because i need it for a power measurement system. The power meter was only able to communicate with mqtt.
« Last Edit: February 02, 2022, 09:14:23 pm by af0815 »
regards
Andreas

Tuxscreen

  • Newbie
  • Posts: 5
Re: good mqtt client
« Reply #13 on: February 03, 2022, 01:29:31 am »
I will test some older version of mosquitto...
Keep you posted!

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: good mqtt client
« Reply #14 on: February 04, 2022, 08:21:11 am »
Alternative: https://github.com/ZiCog/mqtt-free-pascal
Did you see that code?
Sorry Avra but this is someone that hits is own head with a hammer to avoid him making mistakes, gives himself a compliment, hit his head again and then distributes it accidentally so he can hit his head again.
The original was much cleaner and less prone to head-ache.

Anyway MQTT is a very simple protocol.

That code should be left alone.

:-X Hahahaha, my bad. I didn't inspect it at all. I have just blindly forwarded a stored pointer to an alternative MQTT repo. Thanks for reviewing it and assigning nil to it.  ::)
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

 

TinyPortal © 2005-2018