Before we begin, let's recap the features that we want to implement:
- The server should notify the client
- Notifications should be pushed only if the reading changes
The first requirement means that we have to replace our /temperature and /humidity API calls with their socket notification equivalents. The second requirement means that we need a way to link our implementation of the first requirement with a mechanism to only push notifications when a reading changes:
It is generally a good practice to make sure that each module in our application functions independently and has only ...