Skip to Content
Practical Internet of Things with JavaScript
book

Practical Internet of Things with JavaScript

by Arvind Ravulavaru
December 2017
Intermediate to advanced
296 pages
5h 56m
English
Packt Publishing
Content preview from Practical Internet of Things with JavaScript

Raspberry Pi MQTTS client

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"
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Test-Driving JavaScript Applications

Test-Driving JavaScript Applications

Venkat Subramaniam
Web Caching and Replication

Web Caching and Replication

Michael Rabinovich, Oliver Spatscheck

Publisher Resources

ISBN: 9781788292948Supplemental Content