The obniz device sends the data to obniz Cloud. The Node.js program that gets the data from obniz Cloud and passes it to the service system is the "Hosted App."
The service provider needs to develop a system (Hosted App) to acquire the data from obniz and link it to the service.
Overview of the process
- Get device information from the API published by obniz Cloud
- Format the acquired data
- POST to the specified location
Sample code:
const data = SomeSensorClass.getScanData(someSensorInstance); // a
const formattedData = format(data); // b
await sendToMyServiceSystem(formattedData); // c
Features of Auto-scale and redundancy are implemented as standard.
It is theoretically possible to make a similar mechanism without Hosted App if you directly call the API published by obniz Cloud from the service system to get the data of obniz devices.
For this reason, the Hosted App mechanism may seem redundant, but it is so helpful when scale or redundancy is required.
For example, let's assume that a large number of restaurants will introduce the aforementioned CO2 concentration measurement system. Then, as the number of obniz devices increases, the amount of data handled by the server of the system increases, and program operation such as scaling and redundancy becomes a problem.
With Hosted App, obniz-app-sdk (see below) includes the features of auto scale and various load balancing. That allows service providers to focus on developing business logic.