December 2017
Intermediate to advanced
296 pages
5h 56m
English
In this section, we are going to put together the MQTTS broker. We are going to use Mosca (http://www.mosca.io/) as a standalone service (https://github.com/mcollina/mosca/wiki/Mosca-as-a-standalone-service).
Create a new folder named chapter2. Inside the chapter2 folder, create a new folder named broker and open a new command prompt/terminal inside the folder. Then run the following:
npm install mosca pino -g
This will install Mosca and Pino globally. Pino (https://github.com/pinojs/pino) is a Node.js logger, which logs all the messages to the console thrown by Mosca.
Now, the default version of Mosca implements MQTT. But we want to secure our communication between the smart device and cloud to avoid man-in-the-middle ...