O'Reilly logo

Mastering Internet of Things by Peter Waher

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Subscribing to topics

Subscribing to topics is easy. You call the SUBSCRIBE method with one or more topics you're interested in. For each topic, you can also provide the maximum Quality of Service level you want to support on your end. Anything published with a higher Quality of Service will be downgraded on your connection. You can also use the wildcard characters, + (node) and # (branch), in your subscription request. In our example, we choose to subscribe to the Waher/MIOT/[DEVICE_ID]/Set/+ topic. Through it, publishers can execute generic set commands on actuator properties. The name of the actual property is defined by the sender, in the last subtopic node. We update the OnStateChanged event handler as follows:

this.mqttClient.OnStateChanged ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required