There are two basic solutions to this problem if HTTP is to be used:
- Make the device public or reachable by interested parties. This means making the device into a web server. A sensor can return momentary values immediately as responses to GET method calls, and actuators can react directly on control state POST requests. Latency is minimized.
- Emulate a Publish or Subscribe pattern, constantly pushing new sensor information to the server using POST requests, and at the same time polling the server, perhaps using the same POST request, for any new control actions to execute. In this case, the device is a web client, and the server is responsible for pushing the information to interested parties.
In this book, ...