comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: SimpleComponents / MQTT
Date: Wed, 29 Jun 2022 17:00:13 +0200	[thread overview]
Message-ID: <t9hpds$mqr$1@gioia.aioe.org> (raw)
In-Reply-To: b4ff5bf4-0d7c-4481-8909-0136da0e2ca5n@googlegroups.com

On 2022-06-29 12:15, slos wrote:

> I'm having fun playing with SimpleComponents MQTT implementation and I have some questions...
> 
> I'm on Debian Sid using :
> GNAT Studio 23.0w (20220512) hosted on x86_64-pc-linux-gnu
> GNAT 11.3.0 targeting x86_64-linux-gnu
> 
> GNAT Studio
> (c) 2001-2022 AdaCore
> 
> Building the test application is fine using :
> gprbuild -d -P/home/slos/Ada/SimpleComponents/components_4_62/test_components/components-connections_server-mqtt-test_mqtt.gpr -XObject_Dir=. -Xarch=x86_64 -XTarget_OS=Windows -XDevelopment=Debug -XLegacy=Ada2012 -XAtomic_Access=auto -XTasking=Multiple -XTraced_objects=Off /home/slos/Ada/SimpleComponents/components_4_62/test_components/test_mqtt_client.adb
> 
> Running using either "test.mosquitto.org" or local mosquitto gives an exception after some messages received :
> Exception raised
> raised GNAT.SOCKETS.SERVER.CONNECTION_ERROR : gnat-sockets-server.adb:1145
> 
> I don't recall having got exceptions with Gnat Community 2021 on Windows.
> Could you please have a look on that behaviour ?

It means that the other side (mosquitto) dropped the connection.

One possible case is when ping timeout (Keep_Alive) is set but the 
client was silent for the period of time. You should send ping before 
the timeout expires or reconnect.

> It should be possible to use user name and password but I haven't found how with your implementation.
> Could you tell please ?

User and password are set after TCP/IP connection established during 
handshake (see Send_Connect).

> Of course, one should use TLS in this case. Is it feasible and how ?

Well, MQTT does not require SSL/TLS for user/password during the 
handshake. But logically yes, without a secure layer (e.g. provided 
GNUTLS or OpenSSL connection handlers) it makes little sense.

With SSL/TLS you could probably map users to certificates/keys and drop 
user/password, but for the server side it is easier to have them in 
order to maintain user access rights.

(In my opinion MQTT is a toy thing not be used for serious applications, 
though I admit, it is hugely popular)

> Also, how to provide a timestamp ?

Hmm, where? MQTT is totally low-level. There are only string topic and 
string messages, nothing else. Otherwise? if you want to send a time 
stamp in a message use FILETIME or UNIX time epoch and pack 8 bytes UTC 
offset to (low or big endian) in the corresponding resolution. MQTT 
payload need not to be printable.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2022-06-29 15:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29 10:15 SimpleComponents / MQTT slos
2022-06-29 15:00 ` Dmitry A. Kazakov [this message]
2022-07-01  8:51   ` slos
2022-07-01 11:05     ` Dmitry A. Kazakov
2022-07-01 13:22       ` slos
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox