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

Creating an XMPP sensor server

To make our data available on the network, we create a SensorServer object in both of our projects. We need a variable to reference our server:

private SensorServer sensorServer = null; 

In our AttachFeatures method, we create an instance of this object, and provide an event handler for the principle event: OnExecuteReadoutRequest. This event is triggered each time a sensor data request is received. It is also triggered when a subscription event is triggered, and an event message is being created. The SensorServer object takes care of registering required handlers on our XMPP client:

this.sensorServer = new SensorServer(this.xmppClient, true); this.sensorServer.OnExecuteReadoutRequest += async (sender, e) => ...

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