From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!news.gegeweb.eu!gegeweb.org!aioe.org!gz+JwLUglqIuIsOsQSSzqA.user.46.165.242.91.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: SimpleComponents / MQTT Date: Wed, 29 Jun 2022 17:00:13 +0200 Organization: Aioe.org NNTP Server Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: gioia.aioe.org; logging-data="23387"; posting-host="gz+JwLUglqIuIsOsQSSzqA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader01.eternal-september.org comp.lang.ada:64053 List-Id: 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