Commit 6857094b authored by Peter Waher's avatar Peter Waher

Adding event subscription examples

parent 29d8006f
......@@ -113,3 +113,55 @@ within this time frame, plus an additional latency coefficient, the subscription
Note: Only reissue subscription requests if the device is online. If the device comes back online after having been offline, the subscription request can be
reissued.
Examples
-----------------
### Simple event subscription
Subscription request:
```xml
<iq type='get' id='28' to='device@example.org/abcd'>
<subscribe xmlns='urn:ieee:iot:events:1.0' id='d4fe61155cb14e649e302092d3b406a8' m='true' minInt='PT1S' maxInt='PT1M'>
<f n='Light' v='25.72' by='1'/>
<f n='Motion' v='0' by='1'/>
</subscribe>
</iq>
```
Subscription response:
```xml
<iq id='28' type='result' to='client@example.org/1234' from='device@example.org/abcd'>
<accepted xmlns='urn:ieee:iot:sd:1.0' id='d4fe61155cb14e649e302092d3b406a8'/>
</iq>
```
Event:
```xml
<message to='client@example.org/1234' from='device@example.org/abcd'>
<resp id="d4fe61155cb14e649e302092d3b406a8" xmlns="urn:ieee:iot:sd:1.0">
<ts v="2018-07-18T15:19:57.732">
<q n="Light" m="true" ar="true" v="26.11" u="%" />
<b n="Motion" m="true" ar="true" v="true" />
</ts>
</resp>
</message>
```
Unsubscription request:
```xml
<iq type='get' id='29' to='device@example.org/abcd'>
<unsubscribe xmlns='urn:ieee:iot:events:1.0' id='d4fe61155cb14e649e302092d3b406a8'/>
</iq>
```
Subscription response:
```xml
<iq id='29' type='result' to='client@example.org/1234' from='device@example.org/abcd'/>
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment