How to use SuperIOT MQTT
MQTT is based on publish / subscribe pattern, where clients (SuperIOT gateways or applications) can subscribe to receive information and / or publish information on selected topics.
Topics
MQTT protocol allows to group data in so called 'topics'. Topic is similar to a path as known on the computer directories (folders) that allows information to be filtered.
Topics are constructed like "/demo1/gateway_1/node_123", mind that "/" is used to separate topic levels. You can also use wildcards to subscribe to multiple of topics, like:
"+" (plus sign) - example: "/demo1/+/node_123" - here the "+" character replaces any string; therefore you will receive information send to topics like:
"/demo1/gateway_1/node_123"
"/demo1/gateway_2/node_123",
"/demo1/anyotherstring/node_123"
etc.
"#" (hash sign) - example: "/demo1/#" - replaces all remaining levels of the topic, thus client will receive data from topics like:
"/demo1/gateway_1/node_123"
"/demo1/gateway_3/node_222"
"/demo1/gateway_1/node_555"
How to test
Server url: superiot.mpicosys.com
Server port: 1883 (default)
User name: superiot
Password: superiot
On linux platform
Install 'mosquitto-client' package, on debian alike distribution:
To test, open one terminal window with subscriber:
On the other terminal type:
Other platform, online
If you do not use linux environment, you can use any online mqtt client like: link You need to configure network connection (click on configure icon) and set the server / username / password, connect to server and test by publishing data to a topic.
Programming environment
There are many libraries and modules for any programming language. For python you may use link
Data format
Data conveyed by the MQTT protocol is treated binary, thus it can be in any form. As agreed on the project meetings we will be transmitting data in JSON format with as much as possible descriptive information. Please choose data format that suits your purpose, but keep descriptive names of conveyed data, like: