Everything that can be automated will be automated -Robert Cannon - Internet Law and Policy Expert
MQTTBox is a handy application for the creation and testing of the MQTT protocol. What the MQTTBox allows is connecting to MQTT brokers and performing a variety of sufficiently comprehensive tests for them and other MQTT devices to aid in the development of IoT systems. You'll be using MQTTBox in the following exercise for connecting a simulated IoT machine.
The tutorial below will act as a step-by-step guide for you on how to create a simulated device and connect it with IBM Watson while using the MQTT protocol.
The opportunity we have is to build a secure, intelligent platform that solves some of the world’s greatest problems at scale. That’s what’s possible with hundreds of billions of connections and the capabilities that we can deliver together. - Chuck Robbins, Chairman & CEO, Cisco
Set Your IBM Watson Security Setting
For this exercise to work, you need to allow data connections without the Transport Layer Security (TLS) protocol. This is done to allow unencrypted messages.
Please note that working without encryption means that third parties can see the information being sent in the network messages when intercepting them. NEVER include sensitive information in unencrypted messages!
Navigate to your setting on IBM Watson through the left side menu by first clicking 'Security', then 'Connection Security', and then change the Default Rule's 'Connection Security' to 'TLS Optional'. Click 'OK' on the warning popup.
Download and Install MQTTBox
In this exercise, you will be using the Google Chrome browser extension of MQTTBox which you can get by following this link. You can also do a search on Chrome Web Store or directly on Google. You should be able to find the MQTTBox extension using the search term 'Browser Extension MQTT'. Additionally, MQTTBox can also be found online from Microsoft Store.
Install the application.
Create the MQTT Client
Once you have the MQTTBox installed open the application. Click on the 'Create MQTT Client' button.
Setup the MQTT Client
On MQTTBox fill in the fields accordingly as described below.
MQTT Client Name
MQTT Client Id
Your unique id can be found from IBM Watson's URL. Use the device type and id from the last exercises. Please also note the ids are separated by colons.
Append timestamp to MQTT client id?
Timestamping helps prevent attempts to connect to the broker with another client with the same name as another, which should not be an issue during this exercise.
This is the domain you'll be connecting the client to. Remember to add the 'messaging' part.
You should have it written down and saved, as it cannot be retrieved later after it has been given to you.
Send a Message to IBM Watson
After filling all the fields in the previous step hit the 'Save' button. You should see the client connecting to IBM Watson.
On MQTTBox fill in the following fields and send the message by pressing 'Publish'.
Topic to publish
The last part defines that the message will use the JSON format.
The message is in JSON format. It contains the current year as a string.
You have set up an MQTT client that listens to your device. You can now move on to the next exercise!