MQTT is a messaging protocol designed for machine-to-machine communication. It uses the publish-subscribe pattern that is convenient for our purposes. What is special in this protocol is that a broker is required to relay the messages. Messages are passed onto different “topics.” Clients can either publish or subscribe to a certain topic. When one publishes to a topic, all the subscribers of that topic will receive the message. For this project, the topic we use for the server to send messages to the balls is ball/get and the topic for the balls to send messages to the server is ball/put.
How to set up a broker For development purposes, it is sometimes convenient to use public MQTT brokers. The public brokers we have tried are: Mosquitto, shiftr, and HiveMQ. The following are the urls used to connect to them.