We will create two client applications, one for Raspberry Pi, which will act as the sender (publisher), and one at the server, which will act as the receiver (subscriber). This will help us to implement and better understand the architecture of MQTT. Our implementation will look like the diagram shown in Figure 3.12:
Let's write the desktop client application first. We will straight away write the code and not get into the Node.js setup, which we have already done in an earlier part of this chapter:
- Create a file with the name desktop_client.js under any folder of your choice; just make sure you have Node.js and its ...