How to get notified when a new Things goes online in SensorThings?
Pre-requisite
- Please read the previous post regarding how to receive notifications via SensorThings MQTT
Subscribe to the Things
It is very easy to receive a notification when a Thing
has been added to a SensorThings. Simply subscribe to the following topic, and then you can receive messages whenever a Thing
joined the SensorThings service:
v1.0/Things
See here for the example code
But in order to receive a message for new Things
, you will need to add a new Thing
. Please use our SensorThings dashboard (http://ogcpilot.sensorup.com/admin/#/things) to add a new Thing
.
- Click Create
- For now, just enter any text in the Description.
- And you will see the
Thing
created in the dashboard
- At the same time, you should receive a message pushed to you (see below)
Note that, the only difference between this sample code to the previous one that subscribes to new Observations
, is the topic. When you subscribe v1.0/Datastreams(id)/Observations
, you receive new Observations
. When you subscribe to v1.0/Things
, you receive new Things
. I guess it makes sense, eh?
BTW, the above Thing
subscription will not only receive notifications regarding a new Thing
joining, but also an existing Thing
leaving.