(Created page with "DreamFactory v2.8.0 and greater includes support for MQTT (Message Queuing Telemetry Transport), a lightweight messaging protocol commonly used for exchanging information betw...")
Revision as of 17:35, 12 April 2018
DreamFactory v2.8.0 and greater includes support for MQTT (Message Queuing Telemetry Transport), a lightweight messaging protocol commonly used for exchanging information between servers and often resource limited physical devices commonly hosted in low bandwidth network environments. You can configure DreamFactory to provide a REST API which can both publish data to, and retrieve data from (subscribe), an MQTT broker.
The service integration requires the [Mosquitto-PHP] PHP extension to be installed on your server. You'll also need to install the Mosquitto development headers. Operating system-specific instructions are provided at [https://mosquitto.org/download/]. If you're running Linux but don't know what operating system you're using, you can run the following command to learn more:
$ cat /etc/*release* NAME="Amazon Linux AMI" VERSION="2017.09" ID="amzn" ID_LIKE="rhel fedora" VERSION_ID="2017.09" PRETTY_NAME="Amazon Linux AMI 2017.09" ANSI_COLOR="0;33" CPE_NAME="cpe:/o:amazon:linux:2017.09:ga" HOME_URL="http://aws.amazon.com/amazon-linux-ami/" Amazon Linux AMI release 2017.09 cpe:/o:amazon:linux:2017.09:ga
This output indicates Red Hat Enterprise Linux is used, so after following the associated instructions on the aforementioned link the Mosquitto development headers using the following command:
$ sudo yum install libmosquitto-devel
Next you'll need to install the Mosquitto-PHP client. This is most easily accomplished with PECL however keep in mind the Mosquitto-PHP version may have changed:
$ sudo pecl7 install Mosquitto-0.4.0
Once installed you'll need to make PHP aware of the extension. This can be done in a few different ways and depends upon your specific PHP installation, however the easiest universal solution involves adding the following line to your php.ini file:
With the extension in place, you'll need to restart the PHP service in order for the configuration changes to take effect.