...
This class is a simple MQTT publisher that sends messages to a TOPIC; the broker is test.mosquitto.org and the topic is cal-poly/csc/309. Run this and the subscriber at the same time.
This class is a simple MQTT subscriber that listens to a TOPIC; the BROKER is test.mosquitto.org and the topic is cal-poly/csc/309. Run this and the publisher at the same time.
This class is a simple MQTT publisher and subscriber (two in one). It publishes messages on two topics and listens to a one of it own topics; the test.mosquitto.org is used as broker. This application can be run alone.
A drafted class diagram of the current release is as follows:
Important
Allowing connections from clients outside of our machine
When trying to send messages to the broker you might have noticed that when you connect to the broker from a different machine than the one where the broker was installed that you were unable to do so.
This is due to the operating system not having the needed ports configured. To change this we have to create an inbound rule for mosquitto brokerâs TCP port (by default it is port 1883 but you can change it in the .conf file).
On Windows, open your Windows Defender Firewall (you can get to it by going to Control Panel > Change to large icons > Windows Defender Firewall)
Go to Advanced settings
Click on âInbound Rulesâ and then on âNew RuleâŚâ
On the âNew Inbound Rule Wizardâ window, select âPortâ and hit next.
Select âTCPâ and âSpecific local portâ, on the portsâ textbox type 1883 (or your mosquitto broker port if you changed it yourself in the .conf file). Hit next once you are done.
Now select âAllow the connectionâ and hit next.
Now select to what domains that this rule applies to (Domain, private or public). You can select all but this is not recommended in a production environment. Hit next once you are done and finally type a name for your new rule. Name it something like âMQTT Broker Portâ and hit Finish.
Now your rule is created and you should be able to connect from another machine in the same network.