Creating our socket implementation in our application server

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 ...

Get Full Stack Web Development with Raspberry Pi 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.