Introduction to STA‐WebSub - opengeospatial/developer-events GitHub Wiki
The SensorThings API Extension: WebSub Asynchronous Messaging - STA-WebSub Draft Standard - defines an additional SensorThings API capability that supports the distribution of updates via HTTP(S) as defined in the W3C WebSub Recommendation (see W3C WebSub).
The use of STA-WebSub improves the flexible use of SensorThings API services for building asynchronous workflows. The ability to define trigger conditions and to specify the event data structure that is pushed in notifications enables a fit-for-purpose processing of events using workflows. Access control can be implemented in the discovery functionality which controls the subscription based on business or access control policies. Any SensorThings API service that extends the MQTT topic pattern to include filter and expand capabilities via ODATA query parameters will allow to subscribe for updates by the subscription to include triggering conditions using $filter. Using the ODATA query parameter $select and $expand also supports the ability of the subscriber to get exactly the data and structure optimal for its purpose.
A subscriber can fetch base data from a SensorThings API service and then use the same identical URL to subscribe for updates. This avoids the need for any subscriber to poll a SensorThings API service because any updates - that match the URL used - get submitted to the subscriber's Webhook when the update event is triggered. The use of this WebSub extension is also easy to integrate into existing systems as producers only need to set up a W3C WebSub compliant Hub that listens for subscription updates via MQTT. Consumers only need to setup a WebSub Subscriber to receive updates on a dedicated WebHook via HTTP(S) POST.
When using the STA-Web Standard, the SensorThings API MQTT protocol does not need to be exposed to the "world". The MQTT protocol can remain internal (hidden) between the SensorThings API service and the associated STA-WebSub Hub(s). This simplifies the management of access conditions for the SensorThings API's MQTT interface.
During this mentor stream, you will learn what STA-WebSub is and how to achieve asynchronous messaging with a SensorThings API service v1.1. You will see how reference implementations are interconnected to create a complete system for working with STA-WebSub: An open source implementation of a Hub and Subscriber will be used to connect to the open source reference implementation of a SensorThings v1.1 service. A local air quality sensor will be used to create new observations. These observations can be used to trigger live updates to be processed by a subscriber.
As a goal for the working sessions throughout the Code Sprint, We will work towards the following demonstration to be presented during the Demos & Wrap-Ups session on day 3: We will implement different subscriber implementations: A Web Browser based implementation showing the continuous updates in a chart; a NodeJs function acting as a workflow engine to process updates on a dedicated Webhook.