December 2017
Intermediate to advanced
296 pages
5h 56m
English
Now we are going to work with the MQTTS client of Node.js.
On the desktop of the Raspberry Pi 3, create a folder named pi-client. Open a terminal and cd into the pi-client folder.
The first thing we are going to do is create a package.json file. From inside the pi-client folder, run the following:
$ npm init
Then answer the question as applicable. Once you are done with that, next we will install MQTT.js (https://www.npmjs.com/package/mqtt) on the Raspberry Pi 3. Run the following:
$ npm install mqtt -save
Once this installation is also done, the final package.json will look the same as this:
{ "name": "pi-client", "version": "0.1.0", "description": "", "main": "index.js", "scripts": { "start": "node index.js"