12-02-2017, 12:08 AM
MQTT is great and so simple. I'm going to work on some videos. Promise.
If you already have an mqtt broker you can add your credentials on the dashboard. Just go to the button at the top that says IOT and MQTT. Enter your server and note the id. It will probably be 2.
Then in your code, you can just do...
//sends Msg of "World!" with topic of "Hello" to MQTT server 2.
If you don't already have an mqtt server, you can install it on ubuntu with
From there, just enter your server ip and port 1883. You don't really need to worry about username and password during your early testing. Eventually you'll want one for production and there are tons of guides for that.
If you have a raspberry pi laying around you can do...
If you already have an mqtt broker you can add your credentials on the dashboard. Just go to the button at the top that says IOT and MQTT. Enter your server and note the id. It will probably be 2.
Then in your code, you can just do...
Code:
mqtt(2,"Hello","World!");
If you don't already have an mqtt server, you can install it on ubuntu with
Code:
sudo apt-get install mosquitto mosquitto-clients
From there, just enter your server ip and port 1883. You don't really need to worry about username and password during your early testing. Eventually you'll want one for production and there are tons of guides for that.
If you have a raspberry pi laying around you can do...
Code:
wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
Code:
sudo apt-key add mosquitto-repo.gpg.key
Code:
sudo wget http://repo.mosquitto.org/debian/mosquitto-wheezy.list
Code:
sudo -i
Code:
apt-get update
Code:
apt-get install mosquitto