46
Subscribe to event
With this service an event can be subscribed by the host to get automatically a notification by the device if the data
of the event has changed.
One event can be registered by different subscribers, but each need must use a unique "cid".
Before the TCP connection is closed the host must unsubscribe all active events !
The active subscribed events can be read out over the IoT core service ->
The subscription to an event is volatile and had to be renewed after each power on cycle.
Method: POST
URL:
Request body data:
{"
code
":"request","
cid
":<Number>,"
adr
": "data/port[N]/<Event>/subscribe", "
reply
": "
reply text
", "
data
": {"callback":
http://<ip address>:<Port>/<Event>, "
datatosend
":
[ ]
}}
Request
element
Value
Remark
code
"request"
-
cid
<Number>
Multiple subscriptions from one source are
allowed, but each will need a unique "cid".
CID must be stored for unsubscribe of
event !
adr
"data/port[
N
]/<srv_element>/subscribe"
For DTE10x :
N
= 1…4
For DTE60x, DTE80x, DTE9Xx:
N
= 1
<srv_element>: Service element to subscribe to.
reply
"reply text"
Optional: Text to be send back in the response.
If not needed, this element can be removed from
the request.
data
{
"callback":
"http://<
ip address
>:
<
Port
>/
<
Event
>",
"datatosend": [ ]
}
Data of the IoT Webserver
(1)
:
IP address
: IP address.
Port
: IP port number.
Event
: Name of the event under which this is
registered in the device. Can be set freely by the
user. To unsubscribe the event from the device,
this name must be taken.
Optional:
datatosend
: The data element addresses, whose
values are sent with the event
(1)
Please check, that the IoT Webserver is available under the IP address and the IP port is not blocked by the
firewall.