Starting with MQTT

(c)2019- 2020 C. ing. Van Leeuwen Btw. for TesCaWeb, Enschede Netherlands
version 1.11

Mosquitto MQTT on the PC

Step one:

I have installed Mosquitto MQTT (version 1.6.4) in H:/program files/Mosquitto.
And perform the basic tests.
In the Mosquitto map there are 3 files:

  1. Mosquitto: the broker
  2. Mosquitto_pub: example of a publisher (sender of information about a topic)
  3. Mosquitto_sub: example of a subscriber (receiver of information about a topic)
 
 

With starting 3 or more Commandline boxes on the PC and following the in the basic test I was able to see how MQTT is working.
Note: The Mosquitto_rr (combination of publisher and subscriber)  was not available after the installation.
I am still searching for this one.
Playing with the parameters, with the Windows Power Shell (WPS) script it is easier to change the parameters.


The WPS script to start up the 3 command windows (update 30-08-2019):

#https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/start-process?view=powershell-6
#https://ss64.com/nt/cmd.html

H:
cd "H:\Program Files\mosquitto"
#start-Process "cmd.exe" -ArgumentList "/K", "`"H:\Program Files\mosquitto\mosquitto.exe`"", " -c ", "mosquittoCvL.conf"," -v "
#Start-Process "cmd.exe" -ArgumentList "/K", "`"H:\Program Files\mosquitto\mosquitto_sub.exe`"",  "-v -t test "
#Start-Process "cmd.exe" -ArgumentList "/K", "`"H:\Program Files\mosquitto\mosquitto_pub.exe`"",  "-t test -m 'helloWorld' ", " --repeat ",  "4", " --repeat-delay 1 "
# put this on the command line for a next message "H:\Program Files\mosquitto\mosquitto_pub.exe"  -t 'test/topic' -m 'helloWorld'

Step two:

The Mosquitto broker has also support for websockets. So it will be possible to make use of a browser the receive and send information.
Ltes find out how this is working.

First I need to modify the configuration file:
 Find a HTML-JScript example that can be used as MQTT client.
I am using https://www.eclipse.org/paho, there you will find jScript support (paho.javascript-1.0.3 library)  for MQTT web sockets. 

Remark:
When executing the html file as locale there is a problem with MS-Edge.
Microsoft Edge is not usable for the  Paho   bacause it is blocking something. I am using Chrome now

Step three

Writing my own client Step four:Creating a SLI for the fischertechnik TXT, this to add MQTT functionality as RoboPro elements to RoboPro

Print Friendly, PDF & Email